[urge]Call to a member function has() on a non-object

New topics about Symfony 2 should go here

Moderators: dcobalt, tiagojsag

[urge]Call to a member function has() on a non-object

Postby ashuma » Tue Jun 05, 2012 8:58 am

hi, everybody, i implement A controller into B controller and use $a->inserData() into B controller.
then, i got a error message:
<b>Fatal error</b>: Call to a member function has() on a non-object in <b>E:\wwwroot\symfony2\vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\Controller.php</b> on line <b>161</b><br />


in the B controller, the insertData function works normally.

there is the inserData() function of B Controller below:
Code: Select all
   public function insertWiki() {
        $wiki = new Wiki();
        return 1111;
        $user = $this->getDoctrine()->getRepository('AcmeUserBundle:User')->find($this->getCurrentID());
   return 2222;
        $wiki->setUser($user);
        $wiki->setParent('0');
      $wiki->setMimeType('0');
      $wiki->setMenuOrder(0);
      $wiki->setCommmentCount(0);
        $form = $this->createForm(new WikiForm(), $wiki);
      return 1111;
      return $this->renderView('AcmeWikiBundle:Admin:create.html.twig', array('form' => $form->createView()));
   }

return 1111 is working;
return 2222 not works.
ashuma
Member
 
Posts: 60
Joined: Thu Apr 19, 2012 7:42 am

Re: [urge]Call to a member function has() on a non-object

Postby ashuma » Tue Jun 05, 2012 5:03 pm

there are somebody got the same problem with me? please help me. tks.
ashuma
Member
 
Posts: 60
Joined: Thu Apr 19, 2012 7:42 am

Re: [urge]Call to a member function has() on a non-object

Postby ashuma » Tue Jun 19, 2012 5:01 am

who can help me? i meet this problem again.
ashuma
Member
 
Posts: 60
Joined: Thu Apr 19, 2012 7:42 am


Return to General Symfony 2 discussion

Who is online

Users browsing this forum: No registered users and 4 guests