Replies: 1 comment 3 replies
-
If I understand your use case correctly, you have a column that maps a relationship.
And you're telling me that previously the Imo that goes against consistency and the way db works - you should have set up a foreign key and that would prevent that as well, wouldn't it? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all, I am not raising this as an issue, because I am not sure it's an issue. Depending on point of view I guess 🤷.
There is an function
HasOne::createEntity()
:I have entity like this. It's very important to note, that column CAN BE nullable. For non-nullable columns the new (v5) behavior is desired.
This throws an exception if expect entity cannot be fetched from DB. BUT I have use case when I create entities in collection from data fetched from clickhouse and sometimes data for this nullable column contains
0
. Which is perfectly valid for my use case and expected. I show "N/A" instead of Target detail.I ended up patching it with this:
I think it is useful to have it "not-so-strict" to provide way how to map custom DB data to "virtual" entities, but still having the benefits of auto-fetching related models. What do you think?
Beta Was this translation helpful? Give feedback.
All reactions