ENHANCEMENT Added SQLQuery->filtersOnFK() (merged from branches/translatable in r64523, thanks wakeless!)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@69895 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-01-08 04:12:54 +00:00 committed by Sam Minnee
parent 2df8b0a13e
commit e07094adad

View File

@ -437,6 +437,17 @@ class SQLQuery extends Object {
);
}
/**
* Checks whether this query is filtering on a foreign key, ie finding a has_many relationship
*
* @return boolean
*/
function filtersOnFK() {
return ($this->where &&
(strpos($this->where[0], "ID` = ") || (strpos($this->where[0], "ID = ") > 0))
);
}
/// VARIOUS TRANSFORMATIONS BELOW
/**