X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FApi4%2FQuery%2FApi4SelectQuery.php;h=2d1a73e265a6a6588c5bcd86b64f357d44785849;hb=c093005e1a7db4d64177da50a689bbcc545fefba;hp=e4f8ceb187fcd6d37715c9b92cbb2cee4d403d77;hpb=6213849afb91b805ad5757ac2e04183d9e788f83;p=civicrm-core.git diff --git a/Civi/Api4/Query/Api4SelectQuery.php b/Civi/Api4/Query/Api4SelectQuery.php index e4f8ceb187..2d1a73e265 100644 --- a/Civi/Api4/Query/Api4SelectQuery.php +++ b/Civi/Api4/Query/Api4SelectQuery.php @@ -138,7 +138,7 @@ class Api4SelectQuery { } $results[] = $result; } - FormattingUtil::formatOutputValues($results, $this->apiFieldSpec, $this->getEntity()); + FormattingUtil::formatOutputValues($results, $this->apiFieldSpec, $this->getEntity(), 'get', $this->selectAliases); return $results; } @@ -275,7 +275,7 @@ class Api4SelectQuery { $suffix = strstr($item, ':'); if ($suffix && $expr->getType() === 'SqlField') { $field = $this->getField($item); - $options = FormattingUtil::getPseudoconstantList($field['entity'], $field['name'], substr($suffix, 1)); + $options = FormattingUtil::getPseudoconstantList($field, substr($suffix, 1)); if ($options) { asort($options); $column = "FIELD($column,'" . implode("','", array_keys($options)) . "')"; @@ -594,7 +594,7 @@ class Api4SelectQuery { } /** - * Join onto a BridgeEntity table + * Join onto a Bridge table * * @param array $joinTree * @param string $joinEntity @@ -604,13 +604,15 @@ class Api4SelectQuery { */ protected function getBridgeJoin(&$joinTree, $joinEntity, $alias) { $bridgeEntity = array_shift($joinTree); - if (!is_a('\Civi\Api4\\' . $bridgeEntity, '\Civi\Api4\Generic\BridgeEntity', TRUE)) { + /* @var \Civi\Api4\Generic\DAOEntity $bridgeEntityClass */ + $bridgeEntityClass = '\Civi\Api4\\' . $bridgeEntity; + if (!in_array('EntityBridge', $bridgeEntityClass::getInfo()['type'], TRUE)) { throw new \API_Exception("Illegal bridge entity specified: " . $bridgeEntity); } $bridgeAlias = $alias . '_via_' . strtolower($bridgeEntity); $bridgeTable = CoreUtil::getTableName($bridgeEntity); $joinTable = CoreUtil::getTableName($joinEntity); - $bridgeEntityGet = \Civi\API\Request::create($bridgeEntity, 'get', ['version' => 4, 'checkPermissions' => $this->getCheckPermissions()]); + $bridgeEntityGet = $bridgeEntityClass::get($this->getCheckPermissions()); $fkToJoinField = $fkToBaseField = NULL; // Find the bridge field that links to the joinEntity (either an explicit FK or an entity_id/entity_table combo) foreach ($bridgeEntityGet->entityFields() as $name => $field) {