ballhogjoni Posted May 13, 2009 Share Posted May 13, 2009 I think I know a good bit of oop but don't know if I can do this. I tried it, but its not working. When I call the saveDomain() from the indexAction() within the indexController I expect to get the name of the table, which in this case, is Domains. Any help, thanks? oh ya, i am using php 5 indexController class IndexController extends Zend_Controller_Action{ function init(){ $this->domain = new Domain(); } function indexAction(){ $this->view->base_url = BASE_URL; $this->domain->saveDomain( BASE_URL ); } } domain model class Domain extends Zend_Db_Table_Abstract { protected $_name = 'Domains'; protected $_primary = 'id'; var $db; function init(){ $this->crud = new Crud( array($this->_name) ); } function saveDomain( $domain ) { $this->crud->Read(); } } crud model class Crud extends Zend_Registry { var $db; var $_tableName; static function init( $tableName ){ $this->db = parent::get('db'); $this->_tableName = $tableName; } /* * */ public function Read( $condition = null, $sql = null ) { echo "<pre>"; print_r($this->_tableName);echo"</pre>"; } } Link to comment https://forums.phpfreaks.com/topic/157899-quick-lesson-in-oop-please/ Share on other sites More sharing options...
Ken2k7 Posted May 13, 2009 Share Posted May 13, 2009 Are all the init methods ran? Also, did you call indexAction() method? Can you show me the snippet where you called them? Link to comment https://forums.phpfreaks.com/topic/157899-quick-lesson-in-oop-please/#findComment-832967 Share on other sites More sharing options...
ballhogjoni Posted May 13, 2009 Author Share Posted May 13, 2009 i figured it out...needed to run __construct instead Link to comment https://forums.phpfreaks.com/topic/157899-quick-lesson-in-oop-please/#findComment-833022 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.