The method name must start with either findBy or findOneBy. Undefined method Symfony?

前端 未结 8 2060
梦谈多话
梦谈多话 2020-11-27 05:22

I am working through part4 of Symfony2, and while updating the controller and helper class code i got the following error message

Undefined method \'getLates         


        
8条回答
  •  我在风中等你
    2020-11-27 06:10

    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")

提交回复
热议问题