My problem is that when I try to find a database record using $em->find
method, it returns me a Controller.
Let me put an example:
Neostat\DiagnosticoBundle\Controller\ComponentController.php
:
$em = $this->getDoctrine()->getEntityManager();
$diagnostico = $em->getRepository('NeostatDiagnosticoBundle:Diagnostico')->find($id);
var_dump(get_class($diagnostico));
It returns Neostat\DiagnosticoBundle\Controller\ComponentController
.
But I have an entity called Diagnostico.php
in src/Neostat/DiagnosticoBundle/Entity/Diagnostico.php
:
namespace Neostat\DiagnosticoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Neostat\PacienteBundle\Entity\Paciente;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Diagnostico
*
* @ORM\Table(name="diagnostico")
* @ORM\Entity(repositoryClass="Neostat\DiagnosticoBundle\Entity\DiagnosticoRepository")
* @UniqueEntity(fields={"nombre"}, message="Ya existe un diagnostico con ese nombre.")
*/
class Diagnostico
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
// etc...
}
What am I doing wrong?