lithium\data\Entity::exists PHP Method

exists() public method

A flag indicating whether or not this record exists.
public exists ( ) : boolean
return boolean `True` if the record was `read` from the data-source, or has been `create`d and `save`d. Otherwise `false`.
    public function exists()
    {
        return $this->_exists;
    }

Usage Example

Beispiel #1
0
 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());
 }
All Usage Examples Of lithium\data\Entity::exists