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

Cannot access property

Error message

Cannot access property '{property}' (not public) in '{className}'

What it means

Model __set guard: an attempt was made to assign a non-public (protected/private) property from outside the class — it is not a mapped column and no setter accepted it, so direct writes to non-public state are refused.

Solutions

  1. Use the model's public setter method for that property
  2. Expose the field in the model metadata/column map if it should be assignable
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Mvc/Model.zep:659 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/e6d44602343ff170. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Mvc/Model.zep:659

                return null;
            }
        }

        // Use possible setter.
        if this->possibleSetter(property, value) {
            return value;
        }

        /**
         * Throw an exception if there is an attempt to set a non-public
         * property.
         */
        if property_exists(this, property) {
            let manager = this->getModelsManager();

            if unlikely !manager->isVisibleModelProperty(this, property) {
                throw new PropertyNotAccessible(property, get_class(this));
            }
        }

        let this->{property} = value;

        return value;
    }

    /**
     * Unserializes an array to the model
     */
    public function __unserialize(array data) -> void
    {
        var container, manager, key, value, snapshot, properties, dirtyState;

        if !isset data["attributes"] {
            let data = [
                "attributes": data

View on GitHub (pinned to b7419de9cd)