• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Delete rule "deny"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete rule "deny"


  • Subject: Re: Delete rule "deny"
  • From: Kaspar Fischer <email@hidden>
  • Date: Mon, 20 Jun 2005 13:38:39 +0200

And let me note that validateForDelete *only* checks whether
the object in question is part of a relationship with a
"deny" delete rule.  So if the model was something like this

  A <---->> B <---->> C
    cascade     deny

where (as indicated) the former relationship has a "cascade"
and the latter a "deny" rule, then an attempt to delete an
instance a of A which relates to an instance b of B which in
turn relates to an instance c of C will not succeed (because
b cannot be deleted).  Nonetheless,

  [a validateForDelete:&error]

returns YES.  (I tried this out.)

Could someone explain the rationale behind this?  In my
application, I need a routine "validateGloballyForDelete"
which checks on the whole object graph.

On 20.06.2005, at 11:10, mmalcolm crawford wrote:
On Jun 20, 2005, at 1:39 AM, Kaspar Fischer wrote:
So does anybody know how one can prevent an object
from being deleted if the deletion would violate
(on an imaginary "Save" operation) a Deny rule?

You can't. You could, however, simply invoke validateForDelete prior to attempting to delete (and don't delete if it returns NO)...

"Determines whether the receiver can be deleted in its current state, returning YES if it can, otherwise NO and in error an NSError that describes the problem. For example, an object can’t be deleted if it has a relationship has a “deny” delete rule and that relationship has a destination object."
<http://developer.apple.com/documentation/Cocoa/Reference/ CoreData_ObjC/Classes/NSManagedObject.html#//apple_ref/doc/uid/ TP30001171-BBCJCJBF>


mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Delete rule "deny"
      • From: Mark Lively <email@hidden>
References: 
 >Delete rule "deny" (From: Kaspar Fischer <email@hidden>)
 >Re: Delete rule "deny" (From: email@hidden)
 >Re: Delete rule "deny" (From: Kaspar Fischer <email@hidden>)
 >Re: Delete rule "deny" (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Delete rule "deny"
  • Next by Date: Re: Delete rule "deny"
  • Previous by thread: Re: Delete rule "deny"
  • Next by thread: Re: Delete rule "deny"
  • Index(es):
    • Date
    • Thread