Unverified Commit 53cd1460 authored by Eileen McNaughton's avatar Eileen McNaughton Committed by GitHub

Merge pull request #16900 from colemanw/api4fix

APIv4 - bugfix in select query
parents f7c335b1 0553996b
......@@ -110,11 +110,10 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface {
* @return array
*/
private function getNtoManyJoinSelects(Api4SelectQuery $query) {
$fkAliases = $query->getFkSelectAliases();
$joinedDotSelects = array_filter(
$query->getSelect(),
function ($select) use ($fkAliases, $query) {
return isset($fkAliases[$select]) && array_filter($query->getPathJoinTypes($select));
function ($select) use ($query) {
return strpos($select, '.') && array_filter($query->getPathJoinTypes($select));
}
);
......
......@@ -394,7 +394,7 @@ class Api4SelectQuery extends SelectQuery {
$col = ($lastLink instanceof CustomGroupJoinable) ? $lastLink->getSqlColumn($field) : $field;
// Check Permission on field.
if ($this->checkPermissions && !empty($this->apiFieldSpec[$prefix . $field]['permission']) && !\CRM_Core_Permission::check($this->apiFieldSpec[$prefix . $field]['permission'])) {
return;
continue;
}
$this->fkSelectAliases[$pathString . '.' . $field] = sprintf('%s.%s', $lastLink->getAlias(), $col);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment