Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Collection Model with get-set

Today I've encountered an issue with a project I'm working on, I've created a model for Mongo with protected variables and get-set functions however, upon calling the save() function no protected variables are saved even though they have been set with their respective setter. In order for the model to work it seems I have to make all variables public without setters.

Is this a bug or intentional?



85.3k
Accepted
answer

Phalcon ODM does not check for setters/getters to change model values, Phalcon uses writeAttribute/readAttribute to change values no matter of their visibility.