(Leopard) Core Data validateForDelete problem

  • Hi,

    I have a strange problem with Core Data.

    I'm not able to delete relationships when delete rule is "Nullify".
    Performing "validateForDelete" fails for each relationship. It comes
    up with a validation error under Leopard. Under Tiger it works as
    aspected.
    I filed a bug report and contacted the DTS team, but no luck until
    now. So I want to ask the list if there are any ideas how to deal it.

    You can test it very easily: Use the Core Data Project Template in
    XCode, create a model with Employee and Salary entities and connect
    them with a relationship. Then create a Master-Detail Interface where
    you can add an employee. Finally write some code, that creates a
    salary, sets the salary to the employee's salary and then run
    validateForDelete: for the employee. This will cause an error.

    If you want to get a test project, just mail me.

    Any ideas?

    Greetings,

    Thomas
  • On Nov 1, 2007, at 11:01 PM, Thomas Dingler wrote:

    > I'm not able to delete relationships when delete rule is "Nullify".
    > Performing "validateForDelete" fails for each relationship. It comes
    > up with a validation error under Leopard. Under Tiger it works as
    > aspected.
    >
    <http://developer.apple.com/releasenotes/Cocoa/CoreDataReleaseNotes/index.ht
    ml#//apple_ref/doc/uid/TP40006503-DontLinkElementID_11
    >

    mmalc
  • I see that it will not be possible so save a context with a reference
    to a deleted object. But I selected the default "Nullify" rule. So no
    references should be there when deleting an object.
    Should this not be recognized by the validation system when I call
    validateForDelete:?

    When performing directly deleteObject: it will work. (But if I
    override validateForDelete to perform own validation and call super
    in there => validation error from the super method call).

    So my question: How to validate for deny rules/nullify rules before
    deleting an object?

    Thomas

    Am 02.11.2007 um 07:09 schrieb mmalc crawford:

    >
    > On Nov 1, 2007, at 11:01 PM, Thomas Dingler wrote:
    >
    >> I'm not able to delete relationships when delete rule is
    >> "Nullify". Performing "validateForDelete" fails for each
    >> relationship. It comes up with a validation error under Leopard.
    >> Under Tiger it works as aspected.
    >>
    > <http://developer.apple.com/releasenotes/Cocoa/CoreDataReleaseNotes/
    > index.html#//apple_ref/doc/uid/TP40006503-DontLinkElementID_11>
    >
    > mmalc
    >
  • I created an own method to check all relationships and delete rules
    of the object I want to delete . So I can present the user an error
    message if deletion is not allowed for the object.
    validateForDelete is now only called from core data when saving the
    store.
    This works for me..

    Thomas

    Am 02.11.2007 um 07:09 schrieb mmalc crawford:

    >
    > On Nov 1, 2007, at 11:01 PM, Thomas Dingler wrote:
    >
    >> I'm not able to delete relationships when delete rule is
    >> "Nullify". Performing "validateForDelete" fails for each
    >> relationship. It comes up with a validation error under Leopard.
    >> Under Tiger it works as aspected.
    >>
    > <http://developer.apple.com/releasenotes/Cocoa/CoreDataReleaseNotes/
    > index.html#//apple_ref/doc/uid/TP40006503-DontLinkElementID_11>
    >
    > mmalc
    >
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today