title: how can I convert to json doctrine association ArrayCollection
body: <p>I have the following association </p>
  
  <pre><code>class User
  {
  ....
  /**
   * @OneToMany(targetEntity="UserNote", mappedBy="user", fetch="EAGER")
   */
  public $userNote;
  ....
  }
  class UserNote implements
  {
   ....
  /**
   * @ManyToOne(targetEntity="User", inversedBy="userNote")
   * @JoinColumn(name="id_user", referencedColumnName="id_user")
   */
  public $user;
  ....
  }
  </code></pre>
  
  <p>The association above, produce the following objetc as result when I select one user that it had some UserNote:</p>
  
  <pre><code>App\Models\Entity\User Object
  (
  [id] =&gt; 4
  [name] =&gt; Filipe Rodrigues
  [email] =&gt; filipe@email.com.br
  [login] =&gt; master
  [password] =&gt; *********
  [date] =&gt; DateTime Object
      (
          [date] =&gt; 2016-05-04 00:00:00.000000
          [timezone_type] =&gt; 3
          [timezone] =&gt; UTC
      )
  
  [lastLogin] =&gt; DateTime Object
      (
          [date] =&gt; 2017-08-09 11:45:38.000000
          [timezone_type] =&gt; 3
          [timezone] =&gt; UTC
      )
  
  [numLogin] =&gt; 161
  [fone1] =&gt; 1112345678
  [fone2] =&gt; 
  [cep] =&gt; 09112000
  [adress] =&gt; Rua Sila NAlon Gonzzaga
  [cpf] =&gt; 289.233.498-52
  [typeUser] =&gt; 3
  [facebook] =&gt; 
  [site] =&gt; 
  [plan] =&gt; 
  [idPlan] =&gt; 1
  [note] =&gt; 
  [fl_vip] =&gt; 
  [fl_trial] =&gt; 0
  [fl_cob] =&gt; 0
  [recorrenceCode] =&gt; 0566AEA4DADA9861147E5F95DD2AF24B
  [billingDay] =&gt; 13
  [status] =&gt; 8
  [token] =&gt; 
  [parent] =&gt; 
  [userNote] =&gt; Doctrine\ORM\PersistentCollection Object
      (
          [snapshot:Doctrine\ORM\PersistentCollection:private] =&gt; Array
              (
                  [0] =&gt; App\Models\Entity\UserNote Object
                      (
                          [id] =&gt; 1
                          [note] =&gt; teste
                          [date] =&gt; DateTime Object
                              (
                                  [date] =&gt; 2018-01-02 00:00:00.000000
                                  [timezone_type] =&gt; 3
                                  [timezone] =&gt; UTC
                              )
  
                          [user] =&gt; App\Models\Entity\User Object
   *RECURSION*
                      )
  
              )
  ......
  </code></pre>
  
  <p>So, when I use json_encode I get the following result:</p>
  
  <pre><code>{
  "id": 4,
  "name": "Filipe Rodrigues",
  "email": "filipe@vitrinekar.com.br",
  "login": "master",
  "password": "ndtidis@23",
  "date": {
      "date": "2016-05-04 00:00:00.000000",
      "timezone_type": 3,
      "timezone": "UTC"
  },
  "lastLogin": {
      "date": "2017-08-09 11:45:38.000000",
      "timezone_type": 3,
      "timezone": "UTC"
  },
  "numLogin": 161,
  "fone1": "1112345678",
  "fone2": null,
  "cep": "09112000",
  "adress": "Rua Sila NAlon Gonzzaga",
  "cpf": "289.233.498-52",
  "typeUser": 3,
  "facebook": null,
  "site": null,
  "plan": null,
  "idPlan": 1,
  "note": null,
  "fl_vip": null,
  "fl_trial": 0,
  "fl_cob": 0,
  "recorrenceCode": "0566AEA4DADA9861147E5F95DD2AF24B",
  "billingDay": 13,
  "status": 8,
  "token": null,
  "parent": null,
  "userNote": {}
  }
  </code></pre>
  
  <p>The userNote didn't convert, how can I convert the doctrine association using json_encode?</p>
  
  <p>Somebody can help me?</p>