I will just simplify my code, I have the following:
The essence of the doctor:
use ...\...\Entity\Paciente;
class Doctor extends Usuario {
public function __construct() {
...
$this->pacientes = new ArrayCollection();
...
}
protected $numColegiado;
private $pacientes;
...
}
Paciente Object:
use \...\...\Entity\Doctor;
...
class Paciente extends Usuario {
}
protected $id;
protected $doctor;
...
public function setDoctor(Doctor $doctor = null)
{
$this->doctor = $doctor;
return $this;
}
public function getDoctor()
{
return $this->doctor;
}
}
Well, the thing is, when I execute this code (of course, there is a relationship, and this object exists in the database):
\Doctrine\Common\Util\Debug::dump($paciente->getDoctor());
He prints the following:
object(stdClass)#804 (28) { ["__CLASS__"]=> string(34) "Knoid\CorcheckBundle\Entity\Doctor" ["__IS_PROXY__"]=> bool(true) ["__PROXY_INITIALIZED__"]=> bool(false) ["id"]=> NULL ["numColegiado"]=> NULL ["pacientes"]=> NULL ["nombre"]=> NULL ["apellidos"]=> NULL ["dni"]=> NULL ["tipo"]=> NULL ["username"]=> NULL ["usernameCanonical"]=> NULL ["email"]=> NULL ["emailCanonical"]=> NULL ["enabled"]=> NULL ["salt"]=> NULL ["password"]=> NULL ["plainPassword"]=> NULL ["lastLogin"]=> NULL ["confirmationToken"]=> NULL ["passwordRequestedAt"]=> NULL ["groups"]=> NULL ["locked"]=> NULL ["expired"]=> NULL ["expiresAt"]=> NULL ["roles"]=> NULL ["credentialsExpired"]=> NULL ["credentialsExpireAt"]=> NULL }
As you can see, all the attributes of the doctor object are equal to zero, the object exists, but it is empty, this object exists in my database, and it is not empty.
Any idea what is going on?
source
share