roukmoute / hashids-bundle

Integrates hashids/hashids in a Symfony project
MIT License
45 stars 14 forks source link

Doctrine ParamConvert issue when id is incorrect #16

Closed bastiengrassaud closed 2 years ago

bastiengrassaud commented 3 years ago

Hi,

I've problem with ParamConverter and Doctrine find entity. When the entity id is incorrect and therefore impossible to unhash, an SQL error is raised on the search request for the entity according to its id. The parameter passed to the SQL request is the hash id.

Why is a NotFound exception not thrown?

Thanks !

roukmoute commented 3 years ago

Hello,

Sorry for not taking your ticket into account until now.

This is not possible on the current version because this bundle does not create an error if the hash could not be performed. All information is sent to DoctrineParamConverter afterwards. So it is the DoctrineParamConverter that provides an error. I agree with you that it would be much better if the hashids-bundle could provide an error before passing to the next ParamConverterInterface.

I am working on a new version that could do that.

roukmoute commented 3 years ago

You can review https://github.com/roukmoute/hashids-bundle/pull/20 if you would like :)

roukmoute commented 2 years ago

https://github.com/roukmoute/hashids-bundle/releases/tag/v3.0.0