I am developing a web system using the concept of symfony services 3.4 Said service makes queries with dql de doctrine, these work correctly if the use of another controller. However, when I want to use them in the defined service, I get the following error:
Call to a member function has() on null
The service is defined in service.yml file as
gestionar_turnos:
class: ComensalesBundle\Controller\GestionTurnoController
The method I'm running is the following
/**
* @Route("/turnos",name="turnos") *
*/
public function mostrarPanel()
{
//return $this->render('Panel turnos/panelTurnos.html.twig');
$servicio = $this->get('gestionar_turnos');
$sedes = $servicio->obtenerSedes();
return $this->render('Panel turnos/panelTurnos.html.twig',
array('sedes' => $sedes,
)
);
}
I guess it must be a problem defining the service, possibly need some additional argument. On the other hand, is it correct to call the service as
$servicio = $this->get('gestionar_turnos');
First of all, I thank you for the good predisposition and all help is welcome. I am learning symfony and the stackoverflow community has helped me a lot. Greetings and good Saturday!