php - Call to a member function setName() on a non-object in symfony2 -


i trying edit form form existing values correctly when try put new data in fields , submit form error of call member function setname() on non-object

my controller method

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     )); } 

this in $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 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                                     ) 

what doing wrong here getting error

call member function setname() on non-object   

any ideas? in advance

your object $patent_group hasn't been found in db.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -