phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\RecordNotPersisted

Change checking cannot be performed because the object has n

Error message

Change checking cannot be performed because the object has not been persisted or is deleted in '{className}'

What it means

Error "Change checking cannot be performed because the object has not been persisted or is deleted in '{className}'" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Mvc/Model.zep:2459

        var name, snapshot, oldSnapshot, value;
        array updated;

        let snapshot = this->snapshot;
        let oldSnapshot = this->oldSnapshot;

        if unlikely !Settings::get("orm.update_snapshot_on_save") {
            throw new UpdateSnapshotDisabled(get_class(this));
        }

        if unlikely typeof snapshot != "array" {
            throw new SnapshotsDisabled(get_class(this));
        }

        /**
         * Dirty state must be DIRTY_PERSISTENT to make the checking
         */
        if unlikely this->dirtyState != self::DIRTY_STATE_PERSISTENT {
            throw new RecordNotPersisted(get_class(this));
        }

        let updated = [];

        for name, value in snapshot {
            /**
             * If some attribute is not present in the oldSnapshot, we assume
             * the record as changed. array_key_exists() is used so a
             * snapshot that legitimately stores `null` is not mistaken for
             * an absent key under the post-5.13.0 Zephir `isset` semantics
             * [#17042].
             */
            if !array_key_exists(name, oldSnapshot) || value !== oldSnapshot[name] {
                let updated[] = name;
            }
        }

        return updated;

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Mvc/Model.zep:2459 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/0674cd6567d4dad8. Report an issue: GitHub.