フォームを編集しようとしていますが、既存の値を持つフォームを正しく取得しますが、フィールドに新しいデータを入力してフォームを送信しようとすると、非オブジェクトのメンバー関数 setName() への呼び出しのエラーが発生します
私のコントローラーメソッドは
public function editAction(Request $request){
$request = Request::createFromGlobals();
$group_id = $request->query->get('id');
$em = $this->getDoctrine()->getEntityManager();
$patent_group = $em->getRepository('MunichInnovationGroupBundle:PmPatentgroups')->find($group_id);
//echo '<pre>';
//print_r($patent_group);
//echo '</pre>';
$form = $this->createForm(new PatentgroupType(), $patent_group);
if ($request->getMethod() == 'POST') {
$form->bindRequest($request);
$name = $form["name"]->getData();
$description = $form["description"]->getData();
$patent_group->setName($name);
$patent_group->setDescription($description);
$em->flush();
return $this->redirect($this->generateUrl('MunichInnovationGroupBundle_portfolio'));
}
return $this->render('MunichInnovationGroupBundle:Patentgroups:edit.html.twig', array(
'form' => $form->createView(),
'group_id' => $group_id
));
}
これは私が $patent_group で得たものです
MunichInnovationGroup\Bundle\Entity\PmPatentgroups Object
(
[id:MunichInnovationGroup\Bundle\Entity\PmPatentgroups:private] => c3e0eb98-ada5-11e1-96a5-9787dec335c2
[name:MunichInnovationGroup\Bundle\Entity\PmPatentgroups:private] => Zoha Ali khan
[description:MunichInnovationGroup\Bundle\Entity\PmPatentgroups:private] => No Description Provided for this Group
[portfolio_id:MunichInnovationGroup\Bundle\Entity\PmPatentgroups:private] => Proxies\MunichInnovationGroupBundleEntityPmPortfoliosProxy Object
(
[_entityPersister:Proxies\MunichInnovationGroupBundleEntityPmPortfoliosProxy:private] => Doctrine\ORM\Persisters\BasicEntityPersister Object
(
[_class:protected] => Doctrine\ORM\Mapping\ClassMetadata Object
(
[reflFields] => Array
(
[id] => ReflectionProperty Object
(
[name] => id
[class] => MunichInnovationGroup\Bundle\Entity\PmPortfolios
)
[portfolioName] => ReflectionProperty Object
(
[name] => portfolioName
[class] => MunichInnovationGroup\Bundle\Entity\PmPortfolios
)
このエラーが発生しているため、ここで間違っていること
Call to a member function setName() on a non-object
何か案は?前もって感謝します