Philippe,

> ... The fact that an EO is deleted when it's removed from the relationship is 
> technical consequence of a model. Don't use it because it's practical ...

Um, what other reason is there to use owning relationships? The documentation 
says

“If a source object owns its destination object, for example, as when an Agent 
object owns its Customer objects, then when something happens so that a 
destination object (Customer) is removed from the relationship, it is also 
removed from the data source. Ownership implies that an owned object cannot 
exist without its owner/”

(in three-odd different places, but always using essentially the same words), 
and if there's anything else in there, I can't find it. I might be completely 
wrong, but this suggests to me that a deletion of object removed from the 
relationship is the very (and also only) purpose of the ”owns” flag?

Thanks and all the best,
OC

> On 27 Feb 2022, at 14:46, Philippe Rabier <prab...@icloud.com> wrote:
> 
> Hi OC,
> 
> When an EO entity A owns an entity  B, consider A and B as a whole. B does 
> not exist separately. If you'd use a nosql document database, everything will 
> be in the same document. The best and known examples of usage are invoices or 
> quotes and their lines. 
> 
> What you want to do is to prevent deletion depending of other information 
> like the invoice status where a hypothetical VALID status would prevent the 
> deletion of the invoice. In that case and if you use Wonder, you could raise 
> an exception when the method willDelete is called. 
> 
> However, in your case, I have some doubts that a company owns departments 
> because maybe a department is linked to employees or budget or other stuffs … 
> a red flag is when you write that all departments must be deleted first 
> before the company. The fact that an EO is deleted when it's removed from the 
> relationship is technical consequence of a model. Don't use it because it's 
> practical in some case ( and in your case, it's not so practical ;-))
> 
> Philippe 
> ————————————
> Sent from my iPhone
> 
> 
>> On 27 Feb 2022, at 12:45, OCsite via Webobjects-dev 
>> <webobjects-dev@lists.apple.com> wrote:
>> 
>> Hi there,
>> 
>> as I am checking all my relationships to make sure I did not another 
>> mistake, I've bumped into something strange.
>> 
>> It looks like EOF prohibits a combination of “owns destination” and the 
>> “deny” delete rule.
>> 
>> Can perhaps anybody explain the rationale behind that?
>> 
>> I must be overlooking something of importance, for it seems to me it is 
>> quite acceptable approach something like “a company owns all the 
>> departments. Whenever one is removed from the relationship, it should be 
>> deleted, no point for it existing separately. Still, I want to prevent 
>> deletion of a whole company which contains a non-zero number of departments; 
>> to prevent user errors, if somebody does want to delete a company, I want 
>> him to remove all its departments first”.
>> 
>> What am I missing?
>> 
>> Thanks,
>> OC
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/prabier%40icloud.com
>> 
>> This email sent to prab...@icloud.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to