2
객체 "one"의 속성을 편집 할 수있는 양식이 있습니다. 이 객체는 다른 객체 인 "many"와 일대 다 관계를 가지고 있습니다. 사용자가 양식에서 "하나"에 "많은"객체를 할당하도록 선택할 수 있기를 바랍니다. 나는 그것을하는 방법을 알아낼 수 없다! 지금Symfony 2에서 객체 목록을 선택하는 방법 객체 양식 편집
: 엔티티 \ One.php 컨트롤러 \ OneController.php
class OneController extends Controller
{
...
public function editAction($oneId, Request $request)
{
if ($oneId) {
$one = $this->getDoctrine()
->getRepository('One')
->find($oneId);
} else {
$one = new One();
}
$em = $this->getDoctrine()->getEntityManager();
$manyEntity = 'Bundle\Entity\Many';
$manyList = new EntityChoiceList($em, $manyEntity);
$form = $this->createFormBuilder($one)
->add('many', 'choice', array('choice_list' => $manyList))
->getForm();
if ($request->getMethod() == 'POST') {
$form->bindRequest($request);
if ($form->isValid()) {
$entityManager = $this->getDoctrine()->getEntityManager();
$entityManager->persist($one);
}
}
}
...
}
이 오류 메시지가 발생 \
class One
{
...
/*
* @ORM\ManyToOne(targetEntity="many", inversedBy="one")
* @ORM\JoinColumn(name="manyId", referencedColumnName="id")
*/
protected $manyId;
...
}
\
"유형의 예상 인수"스칼라 ","Proxies \ BundleEntityManyProxy "가 지정되었습니다.
도움 주셔서 감사합니다.