Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3924

Symfony 4 OneToOne relationship not pulling from database

$
0
0

This issue is so weird!

Example structure of entities relating to each other:

Property -> InstructionToSell (OneToOne) -> acceptedOffer (OneToOne)

If I do something like:

$property = $repo->findOneBy([‘id’=> 1]);

It works, all the relationships come back ok.

But now if I create a custom method in the property repo to search postcode with a LIKE query the acceptedOffer relationship is null

It’s confusing me as to why this is happening? It’s the same entity, same relationships, I’m just loading it via a like instead of directly by Id.

Even if I use fetchAll it works fine.

I hope I explained this well enough it’s difficult to explain what I’m seeing.


Viewing all articles
Browse latest Browse all 3924

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>