Catchable Fatal Error: Argument 1 passed to Controller::__construct() must be an instance of Doctrine\ORM\EntityManager, none given, called
<p>Notification controller </p>

<pre><code>&lt;?php
namespace Main\AdminBundle\Controller;
/* included related namespace */
use Symfony\Component\PropertyAccess\PropertyAccess;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Query;

use Main\AdminBundle\Entity\Notificationmaster;

class NotificationController extends BaseController
  {
      protected $session;
       protected  $em;

public function __construct(EntityManager $em)
{
    $this-&gt;em = $em;
}

/**
 * @Route("/Notification1/{salon_id}",defaults={"salon_id":""})
 * @Template()
 */
public function indexAction($salon_id)
{
        return array("j"=&gt;"jj");
}

/**
 * @Route("/Notification/create/{notification_type}/{notification_title}",defaults={"notification_type":"","notification_title":""})
 */
public function notificationcreateAction($notification_type,$notification_title)
{
    //$this-&gt;em = $em;

        $notificationmaster = new Notificationmaster();     
        $notificationmaster-&gt;setNotification_type($notification_type);
        $notificationmaster-&gt;setNotification_title($notification_title);
        $em = $this-&gt;getDoctrine()-&gt;getManager();
        $em-&gt;persist($notificationmaster);
        $em-&gt;flush();           
        return $notificationmaster-&gt;getNotification_master_id();    
}   
/**
 * @Route("/Notification/List/{notification_for}/{notification_to}/{lang_id}",defaults={"notification_for":"","notification_to":"","lang_id":""})
 */
 public function notificationlistAction($notification_for,$notification_to,$lang_id)
 {
        //$em = $this-&gt;getDoctrine()-&gt;getManager();
        return new Response(json_encode("hi")); 

 }
}
</code></pre>

<p>in twig file </p>

<pre><code> {% set notification_html = render(controller('MainAdminBundle:Notification:notificationlist',{"notification_for":"organization","notification_to":"1","lang_id":"1"})) %}
</code></pre>

<p>Base Controller</p>

<pre><code>class BaseController extends Controller{

public function __construct()
{
    date_default_timezone_set("Asia/Calcutta");
 }
}
</code></pre>

<p>i got this error while i m calling notification list action using <code>Twig file( as above )</code>  </p>

<blockquote>
  <p>Catchable Fatal Error: Argument 1 passed to Controller::__construct()
  must be an instance of Doctrine\ORM\EntityManager, none given, called</p>
</blockquote>

<p>if i remove entity manager , then i got an error in create action Like  </p>

<blockquote>
  <p>Error: Call to a member function has() on a non-object</p>
</blockquote>

<p>because i call this create action using this </p>

<pre><code>$notification = new NotificationController($em);
$notification_id = $notification-&gt;notificationcreateAction('appointment_book','New  Appointment');
</code></pre>

<p>so i have to add entity manager .</p>