title: Initialize a model in Zend Framework
body: <p>According to <a href="http://www.stoimen.com/blog/2010/08/09/models-in-zend-framework-initialize-all-methods-with-init/" rel="nofollow">this blog post</a> it should be possible to have an init() method within the model. Like this:</p>
  
  <p>
  
  <pre><code>class MyModel
  {
      public function init()
      {
          // prepare something
      }   
  
  ... 
  }
  </code></pre>
  
  <p>This does not work for me. Does anybody know if I have to set somewhere a parameter (e.g. in the config file) or if this is not possible any more in my Zend FW version (1.11.4)? I checked with error_log('something') within the init method and it does not get called at all.</p>
  
  <p>UPDATE:
  I have extended Adam's solution a little:</p>
  
  <pre><code>public function __construct() {
      if (get_parent_class($this) != false) {
          parent::__construct();
      }
      if(method_exists($this, 'init')) {
          $this-&gt;init();
      }
  }
  </code></pre>
  
  <p>This way it can be placed in a base class and then extended. Just in case someone needs the same solution later too.</p>