title: Symfony: how to pass the function render() from a service to a controller
body: <p>I have created a simple service as following:</p>
  
  <pre><code>public function showVar($data)
  {
      switch($data){
          case 'test':
              return $this-&gt;render('test/basic.html.twig', array('var'=&gt;$data));
              break;
  
          default:
              return $this-&gt;render('test/warning.html.twig');
      }
  }
  </code></pre>
  
  <p>And loaded it in the controller</p>
  
  <pre><code>public function indexAction()
  {
      $var = 'test';
  
      $locationService = $this-&gt;container-&gt;get('test');
      $ownFunction = $locationService-&gt;showVar($var);
  
      return $ownFunction;
  }
  </code></pre>
  
  <p>This is the error I am getting</p>
  
  <pre><code>Attempted to call an undefined method named "render" of class
  "AppBundle\Service\MyService".
  </code></pre>
  
  <p>I am new to Symfony and I would like to know what exactly the problem is.</p>