_init() protected method

protected _init ( )
Ejemplo n.º 1
0
 protected function _init()
 {
     $this->_autoConfig[] = 'handlers';
     parent::_init();
 }
Ejemplo n.º 2
0
 /**
  * Initializer function called by the constructor unless the constructor
  *
  * @see lithium\core\Object::_init()
  * @throws ConfigException
  */
 protected function _init()
 {
     parent::_init();
     if (!$this->_connection) {
         throw new ConfigException("The `'connection'` option must be set.");
     }
     if (!$this->_source && !$this->_model) {
         throw new ConfigException("The `'model'` or `'source'` option must be set.");
     }
     $connections = $this->_classes['connections'];
     $db = $connections::get($this->_connection);
     if ($model = $this->_model) {
         $model::config(array('meta' => array('connection' => $this->_connection)));
         $this->_source = $this->_source ?: $model::meta('source');
         $this->_locked = $this->_locked === null ? $model::meta('locked') : $this->_locked;
     }
     if ($this->_locked === null) {
         if ($db::enabled('schema')) {
             $this->_locked = true;
         } else {
             $this->_locked = false;
         }
     }
     foreach ($this->_config['alters'] as $mode => $values) {
         foreach ($values as $key => $value) {
             $this->alter($mode, $key, $value);
         }
     }
 }