How to extend model & override findFirst() #15514
-
I'm migrating from 3.4 to 4. I have a model that is extending \Phalcon\Mvc\Model and overriding v4 introduced the fact that All I'm doing is forwarding along the result of Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I would use a query builder honestly. IMO hydration into array should not be used directly the model::find, it promotes inconsistency and it might break a lot of things, also adds a lot more checks just to handle those cases, not only consuming more cycles but also giving it more room to generate problems. |
Beta Was this translation helpful? Give feedback.
I would use a query builder honestly.
We can either consider this a bug or we accept that since it is in v4 this a breaking change so v4 is actually ok with the versioning.
The manual however is not ok since it says it can be done.
IMO hydration into array should not be used directly the model::find, it promotes inconsistency and it might break a lot of things, also adds a lot more checks just to handle those cases, not only consuming more cycles but also giving it more room to generate problems.
Things should be has statically typed has possible, it's easier on codding, IDE, internal checks, etc.