1
FOSUserBundle邀請函的安裝已按手冊完成。
從表面上看,它確實有效。
但是,分析器顯示映射錯誤。
我認爲'inversedBy'的設置是按照手冊中的規定設置的。
你如何看待它?Symfony2 FOSUserBundle邀請函:'inversedBy'映射錯誤
實體
/** @ORM\Entity */
class Invitation
{
/**
* @ORM\OneToOne(targetEntity="User", inversedBy="invitation", cascade={"persist", "merge"})
*/
protected $user;
// ...
/**
* @ORM\Entity
* @ORM\Table(name="fos_user")
*/
class User extends \FOS\UserBundle\Entity\User
{
/**
* @ORM\OneToOne(targetEntity="Invitation", inversedBy="user")
* @ORM\JoinColumn(referencedColumnName="code")
* @Assert\NotNull(message="Your invitation is wrong")
*/
protected $invitation;
// ...
探查
FOS\UserBundle\Entity\User Valid
My\SampleBundle\Entity\User
The field My\SampleBundle\Entity\User#invitation is on the owning side of a bi-directional
relationship, but the specified mappedBy association
on the target-entity My\SampleBundle\Entity\Invitation# does not contain
the required 'inversedBy' attribute.
My\SampleBundle\Entity\Invitation
The field My\SampleBundle\Entity\Invitation#user is on the owning side of a bi-directional
relationship, but the specified mappedBy association
on the target-entity My\SampleBundle\Entity\User# does not contain
the required 'inversedBy' attribute.
哦....非強制性錯誤...我完全忽略了。謝謝你的建議。 – JIGEN