Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set an inverse relationship in XCode

This is a silly question, but I seriously didn't find an answer...

I have a one-to-many relationship from the Entity Events to Discounts and I set a relationship like this in Xcode:

enter image description here

I need that relationship to be inverse, so I can check which Event a Discount is from, but in XCode I can only choose "No Inverse." How can I set that relationship to be inverse?!

If you have to do it programatically, first, seriously? It can't be done from XCode? Secondly, how can I do it? And where should this be done?

Thanks

like image 413
subharb Avatar asked Dec 30 '25 13:12

subharb


1 Answers

To be able to set inverse relationship you need to create it first in destination entity.

So in Discounts entity create relationship to Event that you want to use as reverse (e.g. event), then you will be able to choose it as reverse for your toDiscounts relationship

like image 187
Vladimir Avatar answered Jan 02 '26 03:01

Vladimir



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!