Skip to content

Commit

Permalink
Merge pull request #16900 from colemanw/api4fix
Browse files Browse the repository at this point in the history
APIv4 - bugfix in select query
  • Loading branch information
eileenmcnaughton authored Mar 26, 2020
2 parents f7c335b + 0553996 commit 53cd146
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,10 @@ private function formatJoinResults(&$joinResults, $query, $alias) {
* @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));
}
);

Expand Down
2 changes: 1 addition & 1 deletion Civi/Api4/Query/Api4SelectQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected function joinFK($key) {
$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);
}
Expand Down

0 comments on commit 53cd146

Please sign in to comment.