Saving a model after finding with selected fields

I'm retrieving some models but only need to work with a single property. I use find() restricting properties with the fields query option.

I need to save and have ONLY this property changed. When I save(), the other properties get destroyed.

How can I do this properly?



2.1k
edited 15d ago

hello

you can implement beforeupdate function in you model and clear other property



3.2k

I don't want to clear the other properties; I want them to be unchanged. I only want to update a single property, the property I specify with the fields in the query.

hello

you can implement beforeupdate function in you model and clear other property



2.1k

look at Dynamic update to do this



3.2k

Does with work with the ODM?



2.1k
edited 14d ago

Sorry i have forgot it's for ODM not ORM

Dynamic update is in Phalcon\Mvc\Model; not in Phalcon\Mvc\Collection;