Phalcon 2.0.* - model properties are not retained after findFirst()

Guys,

I've just filed this:

https://github.com/phalcon/cphalcon/issues/10958

What's your opinion - which version behaves correctly - 1.3.5 or 2.x?

Thanks!

None of those behaves correctly, i dont know why you are creating object and then ->findFirst it. Just use ::findFirst as static method, if you want documentation just override this method in model and add PHP DOC.



31.5k

I am instantiating it because in Phalcon 1.3.5 I could set a property and inside afterFetch() I could still access it.

There's nothing wrong with the logic there.

Only, in Phalcon 2.x that behaviour has changed.

findFirst() always returns a new instance of the model in 2.0.x, this to avoid security problems.



31.5k

so, the behaviour of 1.3.5 was invalid and it has changed in 2.0?

edited Sep '15

so, the behaviour of 1.3.5 was invalid and it has changed in 2.0?

from my point of view you're doing something the wrong way (calling a static method with a non static call), and you shouldn't (in fact php should not authorize this). So it's not a behavior change, just a side effect (which was good for you in 1.3.5 and now bad in 2.0).