Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7952607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:54:40+00:00 2026-06-04T02:54:40+00:00

I have a many-to-many relationship between the entities Groups and Contacts. One group can

  • 0

I have a many-to-many relationship between the entities Groups and Contacts. One group can have many contacts, and one contact can exist in many groups.

Now If I were to delete a group how should I handle all the references to the contacts that it holds?

As I see it there are two options: to use the nullify rule, that would set the deleted group reference to nil for those contacts that had that group. But this sort of introduces a micro-management problem. I then have to check each time I’m listing a contacts groups if any of the groups are nil.

So for me the more elegant solution would be that when a group is deleted, I would delete the group reference completely(?) from the contact object so that it will not contain any nil values for groups at all. Is that possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:54:42+00:00Added an answer on June 4, 2026 at 2:54 am

    But this sort of introduces a micro-management problem. I then have to
    check each time I’m listing a contacts groups if any of the groups are
    nil.

    No. See this answer to a similar question. If you set the deletion rule for both the Groups->>Contacts and Contacts->>Groups relationships to nullify, then:

    • deleting a contact will remove that contact from any groups that include it

    • deleting a group will remove that group from any contacts that belong to it

    Collection objects in the Foundation framework (NSArray, NSSet, etc.) never have “nil values.” It is possible to store the NSNull singleton as a value in a collection, but that’s not what the nullify deletion rule does.

    It sounds like the nullify rule is appropriate for both relationships in your situation. The only thing you need to be concerned about is what should happen when you delete all the contacts that belong to a given group or vice versa. A contact that doesn’t belong to any groups makes sense, but what should happen to a group that contains no contacts? If a group with no members doesn’t make any sense for your app, you’ll have to deal with that case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a one to many entity relationship between two entities: EntityP (Parent) <-->>
I have two entities in core data with one to many relationship between them
Suppose i have a one to many relationship between two model entities Entity One
I have a many-to-many relationship between users and groups and I have a table
I have a one-to-many relationship between two classes for this situation. I have a
I have a one-to-many relationship between Foo and Bar and I cannot perform an
android noob... I have two tables, with a one to many relationship between country_tbl
I have a Hash Map (many-to-one relationship between texts and boolean values): name flag
I have a many-to-many relationship between the two entities called events and artists, both
I have a simple has many relationship between 2 entities in Core Data: Team

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.