Symfony 2 - Class "Mingle\StandardBundle\Entity\Product" 不是有效的实体或映射的超类
Symfony 2 - Class "Mingle\StandardBundle\Entity\Product" is not a valid entity or mapped superclass
我在我的包 Mingle\StandardBundle\Entity
中创建了一个 Product.php
文件,如下所示:
<?php
namespace Mingle\StandardBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/*
* @ORM\Entity
* @ORM\Table(name="product")
*/
class Product
{
/*
* @ORM\Column(type="integer")
* @ORM\ID
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/*
* @ORM\Column(type="string",length=100)
*/
protected $name;
/*
* @ORM\Column(type="decimal",scale=2)
*/
protected $price;
/*
* @ORM\Column(type="text")
*/
protected $description;
}
?>
在 Ubuntu 终端中,在 Symfony 项目的根文件夹中,我输入了这个命令:
php app/console doctrine:generate:entities Mingle/StandardBundle/Entity/Product
我遇到问题:
[Doctrine\ORM\Mapping\MappingException]
Class "Mingle\StandardBundle\Entity\Product" is not a valid entity or mapped super class.
找了也不知道怎么解决。请帮忙
注释必须放在/** */
评论块内,否则无法识别。
我在我的包 Mingle\StandardBundle\Entity
中创建了一个 Product.php
文件,如下所示:
<?php
namespace Mingle\StandardBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/*
* @ORM\Entity
* @ORM\Table(name="product")
*/
class Product
{
/*
* @ORM\Column(type="integer")
* @ORM\ID
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/*
* @ORM\Column(type="string",length=100)
*/
protected $name;
/*
* @ORM\Column(type="decimal",scale=2)
*/
protected $price;
/*
* @ORM\Column(type="text")
*/
protected $description;
}
?>
在 Ubuntu 终端中,在 Symfony 项目的根文件夹中,我输入了这个命令:
php app/console doctrine:generate:entities Mingle/StandardBundle/Entity/Product
我遇到问题:
[Doctrine\ORM\Mapping\MappingException]
Class "Mingle\StandardBundle\Entity\Product" is not a valid entity or mapped super class.
找了也不知道怎么解决。请帮忙
注释必须放在/** */
评论块内,否则无法识别。