title: Doctrine ORM relations in Symfony/API Platform
body: <p>I have been on this for 3 days now. I have two entities named <strong>plan</strong> and <strong>planRequirements</strong>.
  The plan contains requirements which would be pre-populated with requirements and tends to be modified with additional requirements without altering the pre-populated requirements.</p>
  <p>This is the plan entity</p>
  <pre><code>#[ORM\Id]
      #[ORM\GeneratedValue]
      #[ORM\Column(type: 'integer')]
      #[ApiProperty(identifier:false)]
      private $id;
  
      #[Groups([&quot;plan:read&quot;, &quot;plan:write&quot;])]
      #[ORM\Column(type: 'integer', nullable: true)]
      #[ApiProperty(identifier:true)]
      private $planId;
  
      #[Groups([&quot;plan:read&quot;, &quot;plan:write&quot;])]
      #[ORM\Column(type: 'json', nullable: true)]
      #[ORM\OneToOne(targetEntity: PlanRequirement::class, inversedBy: 'requirements')]
      private $requirements = [];
  
      #[Groups([&quot;plan:read&quot;, &quot;plan:write&quot;])]
      #[ORM\Column(type: 'json', nullable: true)]
      private $scope = [];
  
  </code></pre>
  <p>for the PlanRequirements entity</p>
  <pre><code>
      #[ORM\Id, ORM\GeneratedValue, ORM\Column(type:&quot;integer&quot;)]
      #[ApiProperty(identifier:false)]
      private $id;
  
      #[Groups(&quot;plan:read&quot;)]
      #[ORM\Column(type:&quot;integer&quot;)]
      #[ApiProperty(identifier:true)]
      private $planId;
  
     #[Groups(&quot;plan:read&quot;)]
     #[ORM\OneToOne( mappedBy: 'requirement', targetEntity: Plan::class)]
     #[ORM\Column(type: 'json', nullable: true)]
      private $requirements = [];
  
  </code></pre>
  <p><em><strong>The relation isn't embedded in the plan endpoint</strong></em>. I made sure that the planId on both entities have the same content.
  What I am trying to achieve is similar to usual SQL join i.e.</p>
  <p>SELECT plan.planId, plan.requirements, plan.scope, PlanRequirements.requirements from plan JOIN requirements ON plan.planId = PlanRequirements.planId;</p>
  <p>Thank you</p>