setDefaultWhereClause(); $this->expandSelectClauseWildcards(); $result->exchangeArray($this->getObjects()); } /** * @return array|int */ protected function getObjects() { $query = new Api4SelectQuery($this); $result = $query->run(); if (is_array($result)) { \CRM_Utils_API_HTMLInputCoder::singleton()->decodeRows($result); } return $result; } /** * @return array */ public function getGroupBy(): array { return $this->groupBy; } /** * @param array $groupBy * @return $this */ public function setGroupBy(array $groupBy) { $this->groupBy = $groupBy; return $this; } /** * @param string $field * @return $this */ public function addGroupBy(string $field) { $this->groupBy[] = $field; return $this; } /** * @param string $expr * @param string $op * @param mixed $value * @return $this * @throws \API_Exception */ public function addHaving(string $expr, string $op, $value = NULL) { if (!in_array($op, \CRM_Core_DAO::acceptedSQLOperators())) { throw new \API_Exception('Unsupported operator'); } $this->having[] = [$expr, $op, $value]; return $this; } /** * @param string $entity * @param bool $required * @param array ...$conditions * @return DAOGetAction */ public function addJoin(string $entity, bool $required = FALSE, ...$conditions): DAOGetAction { array_unshift($conditions, $entity, $required); $this->join[] = $conditions; return $this; } /** * @param array $join * @return DAOGetAction */ public function setJoin(array $join): DAOGetAction { $this->join = $join; return $this; } /** * @return array */ public function getJoin(): array { return $this->join; } }