0
votes

I am working through doctrine and zend framework 2, and while updating the controller class code i got the following error message

Undefined method 'getFkcountryByName'. The method name must start with either findBy or findOneBy!

$country = $entityManager->getRepository('\Synchro\Entity\Geographicalarea')->getFkcountryByName($geographical ['nom_departement']);

how can i resolved that ,thanks

1
Can you paste your repository class and your annotations of Geographicalarea Entity ?Greco Jonathan
Pls add yourself an answer how to resolve for other users.danopz
Do as @copynpaste said or delete your question please...Wilt

1 Answers

0
votes

Even though this question is quite old already, here's a thought for future reference:

Make sure you referenced your custom repository class in your "Geographicalarea" entity's annotations. If you don't, Doctrine will not load your custom repository class, but use the default repository, which does not know about your custom method.

So instead of just having @ORM\Entity in your entity class' annotations write: @ORM\Entity(repositoryClass="Namespaced\Path\To\Custom\Repository").