lithium\data\Entity::set PHP Method

set() public method

Allows several properties to be assigned at once, i.e.: $record->set(array('title' => 'Lorem Ipsum', 'value' => 42));
public set ( array $data ) : void
$data array An associative array of fields and values to assign to this `Entity` instance.
return void
    public function set(array $data)
    {
        foreach ($data as $name => $value) {
            $this->__set($name, $value);
        }
    }

Usage Example

Beispiel #1
0
 public function testModified()
 {
     $entity = new Entity();
     $this->assertEqual(array(), $entity->modified());
     $data = array('foo' => 'bar', 'baz' => 'dib');
     $entity->set($data);
     $this->assertEqual(array('foo' => true, 'baz' => true), $entity->modified());
 }
All Usage Examples Of lithium\data\Entity::set