_init() protected method

Initializes the collection object by merging in collection items and removing redundant object properties.
protected _init ( ) : void
return void
Beispiel #1
0
 /**
  * auto init for setting up items passed into constructor
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $data = $this->_data;
     $this->_data = array();
     foreach ($data as $item) {
         $this->add($item);
     }
 }
Beispiel #2
0
 /**
  * auto init for setting up items passed into constructor
  *
  * @return void
  */
 protected function _init()
 {
     parent::_init();
     $items = $this->_items;
     $this->_items = array();
     foreach ($items as $item) {
         $this->add($item);
     }
 }
Beispiel #3
0
 protected function _init()
 {
     parent::_init();
     foreach (array('data', 'classes', 'model', 'result', 'query') as $key) {
         unset($this->_config[$key]);
     }
     if ($model = $this->_model) {
         $options = array('pathKey' => $this->_pathKey, 'schema' => $model::schema(), 'exists' => isset($this->_config['exists']) ? $this->_config['exists'] : null);
         $this->_data = $model::connection()->cast($this, $this->_data, $options);
     }
 }
 /**
  * Initializes the record set and uses the database handle to get the column list contained in
  * the query that created this object.
  *
  * @return void
  * @see lithium\data\model\RecordSet::$_columns
  * @todo The part that uses _handle->columns() should be rewritten so that the column list
  *       is coming from the query object.
  */
 protected function _init()
 {
     parent::_init();
     if ($this->_handle && $this->_result) {
         $this->_columns = $this->_handle->columns($this->_query, $this->_result, $this);
     }
 }
Beispiel #5
0
 protected function _init()
 {
     parent::_init();
     foreach (array('data', 'classes', 'model', 'result', 'query') as $key) {
         unset($this->_config[$key]);
     }
     if ($model = $this->_model) {
         $pathKey = $this->_pathKey;
         $this->_data = $model::connection()->cast($model, $this->_data, compact('pathKey'));
     }
 }
Beispiel #6
0
 /**
  * Prepares, enables and executes unserialization of the object.
  *
  * Restores state of the object including pulled results. Tries
  * to restore `_handlers` by calling into `_init()`.
  *
  * @param string $data Serialized properties of the object.
  * @return void
  */
 public function unserialize($data)
 {
     $vars = unserialize($data);
     parent::_init();
     foreach ($vars as $key => $value) {
         $this->{$key} = $value;
     }
 }
Beispiel #7
0
 protected function _init()
 {
     $data = $this->_config['data'];
     parent::_init();
     $this->set($data);
     foreach (array('classes', 'model', 'result', 'query') as $key) {
         unset($this->_config[$key]);
     }
 }