public function testConversion() { $data = array('foo' => '!!', 'bar' => '??', 'baz' => '--'); $entity = new Entity(compact('data')); $this->assertEqual($data, $entity->to('array')); $this->assertEqual($data, $entity->data()); $this->assertEqual($entity, $entity->to('foo')); }
/** * deleteFromTree * * deletes a node (and its children) from the tree * * @param \lithium\data\Model $self the model using this behavior * @param \lithium\data\Entity $entity updated tree element */ private static function deleteFromTree($self,$entity){ extract(static::$_tree_config[$self]); $span = 1; if($entity->data($right) - $entity->data($left) != 1){ $span = $entity->data($right) - $entity->data($left); $connection = $self::connection(); $connection->read('delete from '.$self::meta('source').' where '.$parent.'='.$entity->data($self::meta('key')),array('return'=>'resource')); } static::updateNodesIndices($self,$entity->data($right),'-',$span+1); }