Invalid parameter: token tokenName is not defined in the query.
->setParameter() statements to make sure your tokens (or first part of the
setParameter statement) matches the
:tokenName you used in your
$query = $this->getEntityManager() ->createQuery(' SELECT c FROM MyBigBundle:Cat c WHERE c.petName = :petName ') ->setParameter( 'peName' , $petName) ;
That would throw the error:
Invalid parameter: token peName is not defined in the query.
Because of the typo in the setParameter statement, it should be petName, but I put peName.
It sounds like it should be easy to spot, but when you have a few parameters, or you have been coding for several hours in a row, sometimes it’s easy to miss.