Relevant information: I am using Symfony 2.8.x, Doctrine 2.4.8 and JMSSerializerBundle 1.0.
A Resourcecan have a lot Experiences. I am creating an API call to receive Resourceand all associated Experiences.
However, the JSON that I return contains nullin $resourcefor the object Experience.
I use the following method to extract Resource:
$this->findBy([], [], $limit, $offset);
I don't think this should be a problem because I tried to set the sampling mode to EAGERdirectly in the annotation - it still didn't work. I also cleared the cache.
Resource.orm.yml
oneToMany:
experiences:
targetEntity: Experience
mappedBy: resource
fetch: EAGER
Experience.orm.yml
resource:
targetEntity: Resource
inversedBy: experiences
joinColumn:
name: resource_id
referencedColumnName: id
fetch: EAGER
fetch: EAGER
Look, I tried ALL the hot selections!
Answer
, API json:
{
"resources": [{
"id": 1,
"experiences": [{
"resource": null,
"id": 1,
}]
}]
}
null !
, : Doctrine\ORM\PersistentCollection , :

null? ? :