mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-02 14:18:46 +02:00
BUGFIX: Fixed SQLQuery::filtersOnID() for cases where a ClassName filter is inserted before the ID filter.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@84093 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
50176c631b
commit
788b435821
@ -392,11 +392,13 @@ class SQLQuery extends Object {
|
||||
* @return boolean
|
||||
*/
|
||||
function filtersOnID() {
|
||||
return (
|
||||
$this->where
|
||||
//&& count($this->where) == 1
|
||||
&& preg_match('/^(.*\.)?("|`)?ID("|`)?\s?=/', $this->where[0])
|
||||
);
|
||||
$regexp = '/^(.*\.)?("|`)?ID("|`)?\s?=/';
|
||||
|
||||
// Sometimes the ID filter will be the 2nd element, if there's a ClasssName filter first.
|
||||
if(isset($this->where[0]) && preg_match($regexp, $this->where[0])) return true;
|
||||
if(isset($this->where[1]) && preg_match($regexp, $this->where[1])) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user