atk4\data\Model::isDirty PHP Method

isDirty() public method

Will return true if any of the specified fields are dirty.
public isDirty ( $fields = [] ) : boolean
return boolean
    public function isDirty($fields = [])
    {
        if (!is_array($fields)) {
            $fields = [$fields];
        }
        foreach ($fields as $field) {
            $field = $this->normalizeFieldName($field);
            if (array_key_exists($field, $this->dirty)) {
                return true;
            }
        }
        return false;
    }

Usage Example

Beispiel #1
0
 public function testDirtyTimestamp()
 {
     $sql_time = '2016-10-25 11:44:08';
     $a = ['types' => [['date' => $sql_time]]];
     $this->setDB($a);
     $db = new Persistence_SQL($this->db->connection);
     $m = new Model($db, ['table' => 'types']);
     $m->addField('ts', ['actual' => 'date', 'type' => 'datetime']);
     $m->loadAny();
     $m['ts'] = clone $m['ts'];
     $this->assertFalse($m->isDirty('ts'));
 }
All Usage Examples Of atk4\data\Model::isDirty