lithium\data\entity\Document::export PHP Method

export() public method

public export ( array $options = [] )
$options array
    public function export(array $options = array())
    {
        foreach ($this->_updated as $key => $val) {
            if ($val instanceof self) {
                $path = $this->_pathKey ? "{$this->_pathKey}." : '';
                $this->_updated[$key]->_pathKey = "{$path}{$key}";
            }
        }
        return parent::export($options) + array('key' => $this->_pathKey, 'remove' => $this->_removed);
    }

Usage Example

Example #1
0
 /**
  * Saves model data to the database.
  *
  * @return  array
  */
 public function save()
 {
     $this->saveRelationships();
     $this->appendRelationshipData();
     $type = $this->exists() ? 'update' : 'create';
     $doc = new Document();
     $doc->set($this->to_a());
     $query = new Query(array('entity' => $doc, 'model' => get_class($this), 'conditions' => array($this->primaryKey => $this->{$this->primaryKey})));
     $db = static::connection();
     $result = $db->{$type}($query);
     $exported = $doc->export();
     $this->exists(true);
     $this->data[$this->primaryKey] = $exported['update'][$this->primaryKey];
     return $result;
 }
All Usage Examples Of lithium\data\entity\Document::export