我已经创建了一个 symfony 包。我想单独为我的应用程序添加另一个包。所以现在我面临一个问题,即如何将实体从旧包扩展到新创建的包。我正常扩展它,但它给出了错误。
我有这两个捆绑包,
MyFirstBundle
MySecondBundle
MyFirstBundle 实体,
namespace My\FirstBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
*
* @ORM\Table(name="companies")
* @ORM\Entity
* @ORM\HasLifecycleCallbacks
*/
class Company
{
/**
* @var integer $id
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
*
* @Groups({"list_companies", "company_details", "ad_details"})
*/
private $id;
/**
* @ORM\Column(name="name", type="string", length=50, nullable=true)'
*
* @Groups({"ad_details"})
*/
private $name;
MySecondBundle 实体,
namespace My\SecondBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use My\FirstBundle\Entity\Company as BaseCompany;
class Companies extends BaseCompany
{
public function __construct() {
parent::__construct();
}
}
我不确定我是否可以像这样扩展我的实体。使用此实体创建表单时出现错误
Class "MySecondBundle:companies" seems not to be a managed Doctrine entity. Did you forget to map it?