I have the entity:
/**
* @ORM\Entity
* @ORM\Table(name="TERCEROS")
*/
class Empleado
{
/**
* @ORM\Id
* @ORM\Column(type="string", name="CODIGO", length=15)
* @ORM\GeneratedValue(strategy="NONE")
* @var string
*/
protected $cedula;
/**
* @ORM\Column(type="string", name="APELLIDO1")
* @var string
*/
protected $apellido1;
}
and so get the manager:
$path = array(__DIR__.'/../../Entities');
$devMode = getenv('DEV_MODE');
$config = Setup::createAnnotationMetadataConfiguration($path, $devMode, null, null, false);
$config->setProxyDir($path[0] . '/Proxy');
$config->setProxyNamespace('Proxy');
$empleadosManager = \Doctrine\ORM\EntityManager::create(arrayparams, $config);
when using any method find which should return one single Empleado this return null
$empleadosRepository = $empleadosManager->getRepository(Empleado::class);
$empleados = $empleadosRespository->findAll(); //this returns the data correctly
$empleado = $empleados = $empleadosRespository->find('12345678'); //=null
$empleado = $empleados = $empleadosRespository->findOneBy(['apellido1' =>'fulano']); //=null
None are found, even though I have an Empleado with apellido1 = 'fulano' and cedula = '1234567' inserted in the database
PS: I am working with doctrine outside of Symfony.