Archived
1
0
Fork 0

app/models/Data/Base.php: override hasChanged()

Phalcon throws an exception if no valid snapshot data is present.

We override this behaviour by treating no
snapshot data (new row) as changed.
This commit is contained in:
Henrik Hautakoski 2018-08-22 06:06:56 +02:00
parent ee000f4fc4
commit dcff1a81b2
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA

View file

@ -6,4 +6,21 @@ use Phalcon\Mvc\Model;
class Base extends Model
{
/**
* {@inheritdoc}
*
* Phalcon throws an exception if no valid snapshot data is present.
*
* We override this behaviour by treating no
* snapshot data (new row) as changed.
*
* @param string|array $fieldName
* @param boolean $allFields
* @return bool
*/
public function hasChanged($fieldName = null, $allFields = false)
{
return $this->hasSnapshotData() === false
|| parent::hasChanged($fieldName, $allFields);
}
}