The method name must start with either findBy or findOneBy. Undefined method Symfony?
Make sure that you have modified your entity class:
// src/Blogger/BlogBundle/Entity/Blog.php
/**
* @ORM\Entity(repositoryClass="Blogger\BlogBundle\Repository\BlogRepository")
* @ORM\Table(name="blog")
* @ORM\HasLifecycleCallbacks()
*/
class Blog
{
// ..
}
the annotation @ORM\Entity(repositoryClass="Blogger\BlogBundle\Repository\BlogRepository")
is required.
And don't forget to regenerate entities:
php app/console doctrine:generate:entities Blogger
UPDATE
Remove annotation @ORM\Entity
. It overrides correct annotation @ORM\Entity(repositoryClass="Blogger\BlogBundle\Repository\BlogRepository")
In my case adding proper annotation was insufficient.
Deleting Doctrine Cache by php app/console doctrine:cache:clear-metadata
also not worked.
I generate my entities from database by commands
php app/console doctrine:mapping:import --force AcmeBlogBundle xml
php app/console doctrine:mapping:convert annotation ./src
php app/console doctrine:generate:entities AcmeBlogBundle
First command generate orm.xml file for each DB Table in my project. After DELETING all orm.xml files Annotations started work properly.