I have a LibPhoneNumber object $phone
I pass to a repository method. In my repository method I have:
return $this->getEntityManager()
->createQuery(
'SELECT p, m FROM AppBundle:Phone p JOIN p.member m WHERE p.phoneNumber = :phone AND m.allowFind = TRUE'
)
->setParameter("phone", $phone)
->getOneOrNullResult();
The problem is the query that is being generated and run literally inserts 'Object(libphonenumber\PhoneNumber)'
WHERE p0_.phone_number = 'Object(libphonenumber\\PhoneNumber)' AND m1_.allow_find = 1
if I use the default repository method findOneByPhoneNumber($phone)
it correctly converts the phone number into the format in which it is stored in the database +14565551212