Doctrine:Class不是有效的实体或映射的超类,错误

So I am getting the famous:

[RuntimeException]
Namespace "MyAppSomeToolBundle" does not contain any mapped entities.

doctrine:generate:entities [--path="..."] [--no-backup] name

I tried searching for any answers on stackoverflow but nothing seems to work. It seems like my code is properly formated. I also have :

orm:
    auto_mapping: true

I get the error when executing:

php app/console doctrine:generate:entities MyApp\SomeToolBundle\Entity\Lang

Here is my code:

<?php
    namespace MyApp\SomeToolBundle\Entity;

    use Doctrine\ORM\Mapping as ORM;

    /**
     *  @ORM\Entity
     *  @ORM\Table(name="phonetics")
     */
    class Lang
    {
        /**
         * @ORM\Id
         * @ORM\Column(type="integer")
         * @ORM\GeneratedValue(strategy="AUTO")
         */
        protected $id;

        /**
         * @ORM\Column(type="text")
         */
        protected $language;
        /**
         * @ORM\Column(type="text")
         */
        protected $text;
        /**
         * @ORM\Column(type="text")
         */
        protected $option1;
        /**
         * @ORM\Column(type="text")
         */
        protected $option2;
        /**
         * @ORM\Column(type="text")
         */
        protected $rated;
    }
?>

So I am not sure how to properly debug this. Any suggestions would be appreciated.

Why do you use php app/console doctrine:generate:entities ? The error tells you that you've already created entities manually.

You probably wish to generate database tables by executing the following at your application folder.

php -f ./vendor/doctrine/doctrine-module/bin/doctrine-module.php orm:schema-tool:update --force

You can view sql before executing:

php -f ./vendor/doctrine/doctrine-module/bin/doctrine-module.php orm:schema-tool:update --dump-sql