Closed chopstik closed 6 years ago
I think the ->enableHydration(false) part is the problem... It prevents the execution of the part that is needed for it to work here. Not sure if there is a workaround other than adding a trait to the model overwriting the core one.
Cheers Mark.
Are you able to provide a trait HashidTrait that could be added to the table in order to fix the issue? Let me know how things work out. If that even works etc.
We'll take a look for sure.
Thanks a lot. Either way someone maybe can provide a small adjustment to the documentation about this method not working directly.
It turns out it is
->select(['existing' => 1])
which breaks it.
ping @chopstik
https://github.com/dereuromark/cakephp-hashid/pull/14 should solve it?
Seeing a difference in the application of Hashid when using get() & exists() in a Controller. In the following:
debug($eventsTable->exists(['id' => $id]));
returnsfalse
debug($eventsTable->get($id));
returns the entity object as expected.The Hashid debug setting has no impact. Cake's
exist()
appears only to be a normal find method on a Table so presume it should be using the normal call backs Hashid is using? Any ideas why the exist() method would be returning false and not true as expected? Removing the Hashid behaviour from AppTable::initialize 'solves' the problem in that both methods return true/entity as expected.