Call to a member function has() on null symfony2
<p>I have 5 class Categoria, Produto, Subcategoria, Subproduto and Comanda and for execute search in all classes i try make a service like:</p>

<pre>
namespace AppBundle\Controller;


use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class AccessClassController extends Controller{

    /**
     * Retorna todas as categorias ativas
     */
    public function CategoriasAtivasAction()
    {
        $em = $this->getDoctrine()->getManager();

        $categorias = $em->getRepository('AppBundle:Categoria')->findByAtivo(1);

        return $categorias;
    }
}
 </pre>

<p>And i try access the service on ComandaController</p>

<pre>
class ComandaController extends Controller
{
...
public function newAction(Request $request, $id)
    {
        $comanda = new Comanda();

        $categorias = $this->get('categorias.ativas')->CategoriasAtivasAction();
...
</pre>

<p>Then symfony return error</p>

<p><code>
Call to a member function has() on null
500 Internal Server Error - FatalThrowableError
</code></p>

<p>My services.yml has</p>

<pre>

services:
  categorias.ativas:
     class: AppBundle\Controller\AccessClassController

</pre>

<p>Whats wrong?</p>