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?



3.1k
edited Jul '17

hello

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



3.8k

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



3.1k

look at Dynamic update to do this



3.8k

Does with work with the ODM?



3.1k
edited Jul '17

Sorry i have forgot it's for ODM not ORM

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