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:
parent
ee000f4fc4
commit
dcff1a81b2
1 changed files with 17 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue