public function testPropertyAccess() { $entity = new Entity(array('model' => 'lithium\\tests\\mocks\\data\\MockPost', 'exists' => false)); $this->assertEqual('lithium\\tests\\mocks\\data\\MockPost', $entity->model()); $this->assertFalse($entity->exists()); $entity = new Entity(array('exists' => true)); $this->assertTrue($entity->exists()); $expected = array('exists' => true, 'data' => array(), 'update' => array(), 'increment' => array()); $this->assertEqual($expected, $entity->export()); }
public function export() { foreach ($this->_updated as $key => $val) { if (is_a($val, __CLASS__)) { $path = $this->_pathKey ? "{$this->_pathKey}." : ''; $this->_updated[$key]->_pathKey = "{$path}{$key}"; $this->_updated[$key]->_exists = false; } } return parent::export() + array('key' => $this->_pathKey, 'remove' => $this->_removed); }
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); }
public function export() { foreach ($this->_updated as $key => $val) { if ($val instanceof self) { $path = $this->_pathKey ? "{$this->_pathKey}." : ''; $this->_updated[$key]->_pathKey = "{$path}{$key}"; } } return parent::export() + array('key' => $this->_pathKey); }