I created entity User with fields: name, password, email. Do I really need to create a service
that extracts only the records of my email?($this->getContainer()->get('myservice)
)
Please, help me to solve this problem.
protected function execute(InputInterface $input, OutputInterface $output)
{
$em = $this->getDoctrine()->getEntityManager();
$query = $em
->createQuery('SELECT u.email FROM ModelBundle:User u')
->getResult();
$this->getContainer()
output->writeln($query);
}
If i start my command, i have error
[Symfony\Component\Debug\Exception\UndefinedMethodException] Attempted to call method "getDoctrine" on class "Elastica\CoreBundle\Comman d\EmailCommand".