simpli Posted June 16, 2009 Share Posted June 16, 2009 Hi, I am trying to create a class constructor to initialize some properties like this. class Model_DbTable_Tree extends Zend_Db_Table_Abstract { protected $_treePath; public function __construct() { $this->$_treePath = new Model_DbTable_CostTreePath(); } I unfortunately get an error Catchable fatal error: Argument 1 passed to Zend_Db_Select::__construct() must be an instance of Zend_Db_Adapter_Abstract, null given, called in I am working with ZF 1.8. Can anyone point to a possible solution? Thanks, JR Quote Link to comment https://forums.phpfreaks.com/topic/162328-solved-class-constructor-trouble/ Share on other sites More sharing options...
trq Posted June 16, 2009 Share Posted June 16, 2009 We need to see Model_DbTable_CostTreePath's construct. Quote Link to comment https://forums.phpfreaks.com/topic/162328-solved-class-constructor-trouble/#findComment-856916 Share on other sites More sharing options...
simpli Posted June 16, 2009 Author Share Posted June 16, 2009 There is no constructor for Model_DbTable_CostTreePath(). I have a tree and I'm using a closure table to save the path of the items in my tree so along the tree comes a treepath and it's that variable that I'm trying to initialize in the tree class. This is the beginning of the class. After that I just have its method. Is that what you want to see? JR class Model_DbTable_CostTreePath extends Zend_Db_Table_Abstract { protected $_schema = 'test-company'; //Implementer registry et aller chercher le nom de la db pour chaque compagnie dans le registry protected $_name = 'CostTreePath'; protected $_primary = array('ancestor_id','descendant_id'); protected $_referenceMap = array( 'Ancestor' => array( 'columns' => 'ancestor_id', 'refTableClass' => 'Model_DbTable_Tree', 'refColumns' => 'node_id' ), 'Descendant' => array( 'columns' => 'descendant_id', 'refTableClass' => 'Model_DbTable_Tree', 'refColumns' => 'node_id' ), ); .... Quote Link to comment https://forums.phpfreaks.com/topic/162328-solved-class-constructor-trouble/#findComment-856973 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.