ambta/DoctrineEncryptBundle

Issue when mysql column names are under_score and methods camelCase

PhilETaylor opened this issue · 2 comments

so my mysql columns are under_score, my privates in the entity as $under_score and so my getters and setters are setCamelCase and getCamelCase...

So encryp/decrypt doesnt work because of https://github.com/ambta/DoctrineEncryptBundle/blob/master/Subscribers/DoctrineEncryptSubscriber.php#L263

If I import

use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;

and insert before https://github.com/ambta/DoctrineEncryptBundle/blob/master/Subscribers/DoctrineEncryptSubscriber.php#L263

$nameConverter = new CamelCaseToSnakeCaseNameConverter();
$methodName = $nameConverter->denormalize($methodName);

then things work...

I read only the line posted, but it seems to me the best solution here is to use PropertyAccessor.

This helped me to figure out why it wasn't working! Thanks @PhilETaylor