1
나는 간단한 후 UserInterface 엔티티가 : 역할 인터페이스 및 역할 관리
function getRoles()
{
return $this->roles->toArray();
}
및 역할 엔티티 인터페이스와 많은 관계로 많은으로
/**
* @ORM\ManyToMany(targetEntity="Role", inversedBy="users", cascade={"persist"})
*/
protected $roles;
I 양식 유형과 사용자 역할을 관리하려고
:public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('roles');
}
심포니 나에게 오류를 반환
Expected argument of type "Doctrine\Common\Collections\Collection", "array" given
오류가 배열을 반환하는 엔티티 사용자의 getRoles 메소드에 있지만 getRoles가 인터페이스의 메소드이며 배열을 반환해야한다는 것도 알고 있습니다!
누구나 좋은 해결책이 있습니까?
이후의 게터입니다
- 하나는 역할의 목록을 반환 후 UserInterface 인터페이스의 기능입니다 :