Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OneToOne fetch="EAGER" not working #81

Open
KristijanKanalas opened this issue Sep 18, 2018 · 0 comments
Open

OneToOne fetch="EAGER" not working #81

KristijanKanalas opened this issue Sep 18, 2018 · 0 comments

Comments

@KristijanKanalas
Copy link

What is this feature about (expected vs actual behaviour)?

How my code looks:

    /**
     * @ORM\OneToOne(targetEntity="App\Entity\entityY", mappedBy="entityX", fetch="EAGER")
     * @ORM\JoinColumn(name="entityYId", referencedColumnName="id")
     * @var entityY
     */
    private $entityY;

Expected behaviour would be to load data in $Y before I try to access it but the actual thing that is happening is that I am getting a null value in that field.

If I am not using fetch="EAGER" it defaults to fetch="LAZY" which works fine and i do end up having an entity App\Entity\Y in $Y.

How can I reproduce it?

Just make two entities that have OneToOne relationship and in one table put a code similar to this:

    /**
     * @ORM\OneToOne(targetEntity="App\Entity\Y", mappedBy="X", fetch="EAGER")
     * @ORM\JoinColumn(name="XId", referencedColumnName="Yid")
     * @var Y
     */
    private $Y;

Does it take minutes, hours or days to fix?

I am not sure how long it would take to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant