mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
2df8b0a13e
commit
e07094adad
@ -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
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user