title: Symfony2 Extending Controller getParameter()
body: <p>I Want to extend Symfony2 Controller to my project that is using API but I am having error of a non object use getParameter() function look at my code:</p>
  
  <pre><code>namespace Moda\CategoryBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  
  class ApiController extends Controller
  {
      /**
       * @var String 
       */
      protected $_host;
  
      /**
       * @var String
       */
      protected $_user;
  
      /**
       * @var String
       */
      protected $_password;
  
      public function __construct()
      {   
          $this-&gt;_host = $this-&gt;container-&gt;getParameter('api_host');
          $this-&gt;_user = $this-&gt;container-&gt;getParameter('api_user');
          $this-&gt;_password = $this-&gt;container-&gt;getParameter('api_password');
  
      }
  }
  </code></pre>
  
  <p>And next Controller</p>
  
  <pre><code>namespace Moda\CategoryBundle\Controller;
  
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  
  class CategoryController extends ApiController
  {
      /**
       * @Route("/category", name="_category")
       * @Template()
       */
      public function indexAction()
      { 
          return array('name' =&gt; 'test');
      }
  
  }
  </code></pre>
  
  <p>And the end, I got this Fatal Error:</p>
  
  <blockquote>
    <p>FatalErrorException: Error: Call to a member function getParameter()
    on a non-object in (..)</p>
  </blockquote>
  
  <p>I try to use $this->setContainer() but it doesn't work. Do you have any idea how can I slove this problem?</p>