Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, you shouldn't really call the <code>student - class</code> relation <code>studentsToClass</code>. The name of the relation should reflect what type of object is at the other end.</p> <p>E.g.</p> <p>In this case the <code>Student</code> relation to <code>Class</code> should be called <code>class</code> because the object there is a single <code>Class</code> entity. The inverse relation should not be called <code>classToStudent</code> it should be called <code>students</code> because the object there is a <code>NSSet</code> of multiple <code>Students</code>.</p> <p><strong>EDIT</strong></p> <p>Just to add to this. The name of the relation should explain WHY it is there. We can see that the relation is from class to student but if you call it "classToStudent" it doesn't explain anything. Also, what if you have a second relation from class to student? What do you call that. If you call it <code>attendees</code> or <code>pupils</code> or <code>attendingStudents</code> etc.. it gives the relation meaning.</p> <p><strong>SOLUTION</strong></p> <p>In this example I'm going to call them how I would call them and you will see it makes it a bit easier to understand...</p> <p>Anyway...</p> <pre><code>NSPredicate *classPredicate = [NSPredicate predicateWithFormat:@"class.className = %@", @"5th"]; NSPredicate *passPredicate = [NSPredicate predicateWithFormat:@"result.name = %@", @"Pass"]; NSCompoundPredicate *compoundPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[classPredicate, passPredicate]]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload