associated object is showing null instead of correct values #5846

Closed
opened 2026-01-22 15:19:48 +01:00 by admin · 2 comments
Owner

Originally created by @flik on GitHub (Jan 15, 2018).

Originally assigned to: @Ocramius on GitHub.

associated object is coming but values are null ?

here is output :

object(stdClass)[581]
public 'CLASS' => string 'PsnPersonPsn' (length=12)
public 'idPsn' => int 17468
public 'logiurModifiedPsn' =>
object(stdClass)[650]
public 'CLASS' => string 'UserIur' (length=7)
public 'IS_PROXY' => boolean true
public 'PROXY_INITIALIZED' => boolean false
public 'idIur' => int 1
public 'idpsnIur' => null
public 'usernameIur' => null
public 'passwordIur' => null
public 'isActiveIur' => null
public 'isDeletedIur' => null
public 'logDateCreatedIur' => null
public 'saltIur' => null
public 'signatureIur' => null
public 'externalidIur' => null
public 'isApiIur' => null
public 'certserialIur' => null
public 'anonymisedIur' => null
public 'logIdiurIur' => null
public 'logDateModifiedIur' => null
public 'logIdiurModifiedIur' => null
public 'logDateLastloginIur' => null
public 'idconIur' => null
public 'idsystemColPsn' => null
public 'idsystemGenPsn' =>
object(stdClass)[669]
public 'CLASS' => string 'GenderGen' (length=9)
public 'IS_PROXY' => boolean true
public 'PROXY_INITIALIZED' => boolean false
public 'idgenderGen' => int 3
public 'valueEngGen' => null
public 'valueDeuGen' => null
public 'valueFraGen' => null
public 'valueItaGen' => null
public 'valueSpaGen' => null
public 'codeGen' => null
public 'isActiveGen' => null
public 'isDeletedGen' => null

Originally created by @flik on GitHub (Jan 15, 2018). Originally assigned to: @Ocramius on GitHub. associated object is coming but values are null ? here is output : object(stdClass)[581] public '__CLASS__' => string 'PsnPersonPsn' (length=12) public 'idPsn' => int 17468 public 'logiurModifiedPsn' => object(stdClass)[650] public '__CLASS__' => string 'UserIur' (length=7) public '__IS_PROXY__' => boolean true public '__PROXY_INITIALIZED__' => boolean false public 'idIur' => int 1 public 'idpsnIur' => null public 'usernameIur' => null public 'passwordIur' => null public 'isActiveIur' => null public 'isDeletedIur' => null public 'logDateCreatedIur' => null public 'saltIur' => null public 'signatureIur' => null public 'externalidIur' => null public 'isApiIur' => null public 'certserialIur' => null public 'anonymisedIur' => null public 'logIdiurIur' => null public 'logDateModifiedIur' => null public 'logIdiurModifiedIur' => null public 'logDateLastloginIur' => null public 'idconIur' => null public 'idsystemColPsn' => null public 'idsystemGenPsn' => object(stdClass)[669] public '__CLASS__' => string 'GenderGen' (length=9) public '__IS_PROXY__' => boolean true public '__PROXY_INITIALIZED__' => boolean false public 'idgenderGen' => int 3 public 'valueEngGen' => null public 'valueDeuGen' => null public 'valueFraGen' => null public 'valueItaGen' => null public 'valueSpaGen' => null public 'codeGen' => null public 'isActiveGen' => null public 'isDeletedGen' => null
admin added the Question label 2026-01-22 15:19:48 +01:00
admin closed this issue 2026-01-22 15:19:48 +01:00
Author
Owner

@Ocramius commented on GitHub (Jan 15, 2018):

This is normal: proxies are lazy-loaded when you actually try reading their internal state. Ref: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#entity-object-graph-traversal

@Ocramius commented on GitHub (Jan 15, 2018): This is normal: proxies are lazy-loaded when you actually try reading their internal state. Ref: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/working-with-objects.html#entity-object-graph-traversal
Author
Owner

@flik commented on GitHub (Jan 17, 2018):

I fixed this issue by edit the entity with fetch="EAGER" attribute, below is the code example where to change. just add the attribute in foreign fields.

/**
    * @var \GenderGen
    *
    * @ORM\ManyToOne(targetEntity="GenderGen" , cascade={"all"}, fetch="EAGER")
    * @ORM\JoinColumns({
    *   @ORM\JoinColumn(name="idsystem_gen_psn", referencedColumnName="idgender_gen")
    * })
    */
@flik commented on GitHub (Jan 17, 2018): I fixed this issue by edit the entity with fetch="EAGER" attribute, below is the code example where to change. just add the attribute in foreign fields. ``` /** * @var \GenderGen * * @ORM\ManyToOne(targetEntity="GenderGen" , cascade={"all"}, fetch="EAGER") * @ORM\JoinColumns({ * @ORM\JoinColumn(name="idsystem_gen_psn", referencedColumnName="idgender_gen") * }) */ ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5846