实体1
<?php
namespace Operat\SystemBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Operat\AgentsBundle\Entity\Agents;
/**
* Liensao
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="Operat\SystemBundle\Entity\LiensaoRepository")
*/
class Liensao
{
// Liensao - Agents
/**
* @ORM\ManyToOne(targetEntity="Operat\AgentsBundle\Entity\Agents", inversedBy="liensao")
* @ORM\JoinColumn(name="colAgent_Code", referencedColumnName="CODE")
*/
protected $agent;
/*....*/
实体2
<?php
namespace Operat\AgentsBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Operat\SystemBundle\Entity\Liensao;
/**
* Agents
*
* @ORM\Table(name="agents", indexes={@ORM\Index(name="Valide", columns={"Valide"}), @ORM\Index(name="GL", columns={"GL"}), @ORM\Index(name="NSOC", columns={"NSOC"})})
* @ORM\Entity
*/
class Agents
{
// Agents - Liensao
/**
* @ORM\OneToMany(targetEntity="\Operat\SystemBundle\Entity\Liensao", mappedBy="agent")
*/
protected $liensao;
然而又跑了 php app / console doctrine:schema:update --em = entities_system --dump-sql --force
给出以下错误:
[学说\共同\持久性\映射\ MappingException] 课程&#39; Operat \ AgentsBundle \ Entity \ Agents&#39;在链配置的命名空间中找不到Operat \ SystemBundle \ Entity,Operat \ AdministrationBundle \ Entity,FOS \ UserBundle \ Entity
Config.yml
orm:
auto_generate_proxy_classes: "%kernel.debug%"
default_entity_manager: entities_system
entity_managers:
entities_system:
connection: operat_system
mappings:
OperatSystemBundle: ~
FOSUserBundle: ~
entities_agents:
connection: operat_agents
mappings:
OperatAgentsBundle: ~