Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/162328-solved-class-constructor-trouble/
Share on other sites

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'
        ),
    );

....

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.