这些是实体:
Objective.php
namespace Foo\BSCBundle\Entity;
class Objective{
protected $id;
protected $name;
protected $perspective;
...
}
Objective.orm.yml
Foo\BSCBundle\Entity\Objective:
type: entity
table: master.objectives
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
manyToOne:
perspective:
targetEntity: Pespective
inversedBy: objectives
joinColumn:
name: perspective_id
referencesColumn: id
Perspective.php
use Doctrine\Common\Collections\ArrayCollection;
namespace Foo\BSCBundle\Entity;
class Perspective {
protected $id;
protected $objectives;
...
}
Perspective.orm.yml
Foo\BSCBundle\Entity\Perspective:
type: entity
table: perspectives
id:
id:
type: integer
generator: { strategy: AUTO }
fields:
name:
type: string
length: 100
oneToMany:
objectives:
targetEntity: Objective
mappedBy: Perspective
DefaultController.php
public function indexAction($name)
{
$perspective = $this->getDoctrine()
->getRepository('FooBSCBundle:Objective')
->find(1);
$params = array('name' => $name, 'perspective' => $perspective);
return $this->render('FooBSCBundle:Default:index.html.twig', $params);
}
在我的浏览器中,我收到错误:
无法找到目标实体Foo \ BSCBundle \ Entity \ Pespective in' Foo \ BSCBundle \ Entity \ Objective#perspective'。 500内部 服务器错误 - MappingException
我做错了什么?