Constructors in Zend model

In my model, I am extending Zend_Db_Table_Abstract. Inside, I have a protected $_name = 'table_name'.
Now, if I define a constructor, and a private variable private $_var and define it inside the constructor, the model does not work anymore! When I call $this->createRow() or anything, nothing happens! Why is this constructor doing this?!

This is what I have:

 <?php
 class myClass extends Zend_Db_Table_Abstract
 {
      protected $_name = 'table_name';
      private $_var;

      public function __construct($var)
      {
           $this->_var = $var;
      }

      public function getById($id)
      {
           $select = $this->select()->where('id =?',$id);
           return $this->fetchRow($select);
      }
 }

This doesn’t work! If I remove the __construct(), and the private variable, then it works! Why?

Thanks

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories