There was a problem: The project uses Cycle ORM, there are 2 Entities. I am trying to link them using annotation like so:
/**
* @Cycle\Relation\BelongsTo(target = "Company\Core\Entity\CourtInfo\CourtInfo")
*/
protected $court;
But when accessing $repository->findOne()->getCourt() I get:
object(Cycle\ORM\Promise\Reference)#2212 (2) {
["role":"Cycle\ORM\Promise\Reference":private]=>
string(42) "Company\Core\Entity\CourtInfo\CourtInfo"
["scope":"Cycle\ORM\Promise\Reference":private]=>
array(1) {
["id"]=>
int(15705)
}
}
But I want to get Entity. How can I do this correctly? The option works if you add the annotations fetch = "eager" to the parameters, but then it will be loaded eagerly. How can I lazily load related entities?
My Answer:
App\Entity\User::class, nullable = false)*_public $user;*__*But when I try to access the linked model using $entity->user, I get a null value. What am I doing wrong?_
Rate this post
4 of 5 based on 9576 votesComments