Skip to content
This repository
Browse code

Removed 'relation filters' from datamodel docs

Not implemented yet, so we shouldn't document it either
to avoid confusing devs. See #7595
  • Loading branch information...
commit 9ebac90864a941a34972f221ec1bd84c846ad6cb 1 parent ae9c2e7
Ingo Schommer authored August 22, 2012

Showing 1 changed file with 0 additions and 38 deletions. Show diff stats Hide diff stats

  1. 38  docs/en/topics/datamodel.md
38  docs/en/topics/datamodel.md
Source Rendered
@@ -246,44 +246,6 @@ use case could be when you want to find all the members that does not exist in a
246 246
 	// ... Finding all members that does not belong to $group.
247 247
 	$otherMembers = Member::get()->subtract($group->Members());
248 248
 
249  
-
250  
-### Relation filters
251  
-
252  
-So far we have only filtered a data list by fields on the object that you're requesting.  For simple cases, this might 
253  
-be okay, but often, a data model is made up of a number of related objects.  For example, in SilverStripe each member 
254  
-can be placed in a number of groups, and each group has a number of permissions.
255  
-
256  
-For this, the SilverStripe ORM supports **Relation Filters**.  Any ORM request can be filtered by fields on a related 
257  
-object by specifying the filter key as `<relation-name>.<field-in-related-object>`.  You can chain relations together 
258  
-as many times as is necessary.
259  
-
260  
-For example, this will return all members assigned to a group that has a permission record with the code "ADMIN". In 
261  
-other words, it will return all administrators.
262  
-
263  
-	:::php
264  
-	$members = Member::get()->filter(array(
265  
-		'Groups.Permissions.Code:ExactMatch' => 'ADMIN',
266  
-	));
267  
-
268  
-Note that we are just joining these tables to filter the records. Even if a member is in more than 1 administrator 
269  
-group, unique members will still be returned by this query.
270  
-
271  
-The other features of filters can be applied to relation filters as well.  This will return all members in groups whose
272  
-names start with 'A' or 'B'.
273  
-
274  
-	:::php
275  
-	$members = Member::get()->filter(array(
276  
-		'Groups.Title:StartsWith' => array('A', 'B'),
277  
-	));
278  
-
279  
-You can even follow a relation back to the original model class!  This will return all members are in at least 1 group 
280  
-that also has a member called Sam.
281  
-
282  
-	:::php
283  
-	$members = Member::get()->filter(array(
284  
-		'Groups.Members.FirstName' => 'Sam'
285  
-	));
286  
-
287 249
 ### Raw SQL options for advanced users
288 250
 
289 251
 Occasionally, the system described above won't let you do exactly what you need to do.  In these situtations, we have 

0 notes on commit 9ebac90

Please sign in to comment.
Something went wrong with that request. Please try again.