jeremyharris / cakephp-lazyload

A lazy loader for CakePHP entities.
MIT License
61 stars 10 forks source link

Update deprecated Entity::unsetProperty() to use 4.x Entity::unset() #25

Closed jason-horvath closed 4 years ago

jason-horvath commented 4 years ago

Hey hey! It's me again! :D

Hehe, I just noticed that the unsetProperty() method was removed when going through some unit tests on a repo I am working with, and properties were coming back from the dead on me!

Found it here in the migration doc. https://book.cakephp.org/4/en/appendices/4-0-migration-guide.html#orm

jeremyharris commented 4 years ago

Interesting that you mention that properties were coming back. unsetProperty is deprecated, not removed, so it should have been working normally (unless your updated code used unset()).

This change is fine though, so I'm going to merge it. I can tag a new release after the merge.

Thanks again!

jason-horvath commented 4 years ago

Sure, that's a good idea. I can do that when I get a chance here.

jason-horvath commented 4 years ago

Oh and I forgot to mention, the legacy code I am working with was using unset($object->prop) so I think that was part of the issue. That same legacy code works when the trait has unset()

jeremyharris commented 4 years ago

Ok that makes sense as the magic method was updated to use the new unset method. Let's also add a test case for that as well while we're at it. Another copy/paste :)

jason-horvath commented 4 years ago

Another copy paste it is, consider it done!

jeremyharris commented 4 years ago

Much appreciated!