[Security][Acl] Reduce query size when Select ACL entries for many instances of the same Type at once
This commit is contained in:
parent
dc4a10e931
commit
3c3a90b9e5
@ -258,6 +258,32 @@ SELECTCLAUSE;
|
||||
WHERE (
|
||||
SELECTCLAUSE;
|
||||
|
||||
$types = array();
|
||||
for ($i=0,$c=count($batch); $i<$c; $i++) {
|
||||
if(!isset($types[$batch[$i]->getType()])) {
|
||||
$types[$batch[$i]->getType()] = true;
|
||||
if(count($batch) > 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(count($types) === 1) {
|
||||
|
||||
$where = '(o.object_identifier IN (%s) AND c.class_type = %s)';
|
||||
$ids = array();
|
||||
for ($i=0,$c=count($batch); $i<$c; $i++) {
|
||||
$ids[] = $this->connection->quote($batch[$i]->getIdentifier());
|
||||
}
|
||||
|
||||
$sql .= sprintf(
|
||||
$where,
|
||||
implode(',', $ids),
|
||||
$this->connection->quote($batch[0]->getType())
|
||||
);
|
||||
|
||||
} else {
|
||||
|
||||
$where = '(o.object_identifier = %s AND c.class_type = %s)';
|
||||
for ($i=0,$c=count($batch); $i<$c; $i++) {
|
||||
$sql .= sprintf(
|
||||
@ -270,6 +296,8 @@ SELECTCLAUSE;
|
||||
$sql .= ' OR ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$sql .= ')';
|
||||
|
||||
|
Reference in New Issue
Block a user