title: Missing value for primary key id on App\Entity symfony
body: <p>My relation between 2 entities is a <code>OneToOne</code> relation.</p>
  
  <p>1) User Entity:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Entity;
  
  use Doctrine\ORM\Mapping as ORM;
  
  /**
   * @ORM\Entity(repositoryClass="App\Repository\UserRepository")
   */
  class User
  {
  
  
      /**
       * @ORM\Id()
       * @ORM\GeneratedValue()
       * @ORM\Column(type="integer")
       */
      private $id;
  
      /**
       * @var $userContact
       *
       * @ORM\OneToOne(targetEntity="UserContact" ,  inversedBy="User")
       * @ORM\JoinColumn(name="id", referencedColumnName="user_id",  nullable=false)
       **/
      private $userContact;
  
      /**
       * @ORM\Column(type="string", length=255)
       */
      private $last_name;
  
      public function getId()
      {
          return $this-&gt;id;
      }
  
      public function getLastName(): ?string
      {
          return $this-&gt;last_name;
      }
  
      public function setLastName(string $last_name): self
      {
          $this-&gt;last_name = $last_name;
          return $this;
      }
  
  }
  </code></pre>
  
  <ol start="2">
  <li>UserContact Entity:</li>
  </ol>
  
  <p>
  
  <pre><code>class UserContact
  {
      /**
       * @var integer
       *
       * @ORM\Column(name="id", type="integer")
       * @ORM\Id()
       * @ORM\GeneratedValue(strategy="AUTO")
       */
      private $id;  
  
      /**
       * @ORM\Column(type="integer")
       */
      private $user_id;
  
      /**
       * @ORM\OneToOne(targetEntity="User", inversedBy="UserContact")
       */
      private $user;
  
      /**
       * @ORM\Column(type="string", length=255)
       */
      private $mobile_number;
  
      public function getId()
      {
          return $this-&gt;id;
      }
  
      public function getUserId(): ?int
      {
          return $this-&gt;user_id;
      }
  
      public function setUserId(int $user_id): self
      {
          $this-&gt;user_id = $user_id;
  
          return $this;
      }
  
      public function getMobileNumber(): ?string
      {
          return $this-&gt;mobile_number;
      }
  
      public function setMobileNumber(string $mobile_number): self
      {
          $this-&gt;mobile_number = $mobile_number;
          return $this;
      }
  }
  </code></pre>
  
  <p>My User Repository looks like this:</p>
  
  <pre><code>class UserRepository extends ServiceEntityRepository
  {
      public function index() {
          return $this-&gt;createQueryBuilder('u')
              -&gt;innerJoin('u.userContact', 'uc')
              -&gt;getQuery()
              -&gt;execute();
      }
  }
  </code></pre>
  
  <p>And the controller looks like this:</p>
  
  <pre><code> public function index()
      {
         $users = $em-&gt;getRepository('App:User')-&gt;index();  
         }
  </code></pre>
  
  <p>It's throwing an error like this one:</p>
  
  <p><code>Missing value for primary key id on App\Entity\UserContact</code></p>