/** * Возвращает имена типов, которые должны присутствовать в выборке * @throws InvalidArgumentException если заданы невозможные условия выборки * @return array */ protected function getSelectionTypes() { if (!count($this->usedFields)) { return array_keys($this->types); } $fields = array_keys($this->usedFields); if (!count($this->types)) { $types = $this->metadata->getTypesByFields($fields); if (!count($types)) { throw new InvalidArgumentException($this->translate('The selection is not possible. Conditions do not match metadata types.')); } if (!count(array_diff($this->metadata->getTypesList(), $types))) { $types = []; } return $types; } $types = array_keys($this->types); $typesCount = count($types); if (count(array_intersect($this->metadata->getTypesByFields($fields), $types)) != $typesCount) { throw new InvalidArgumentException($this->translate('The selection is not possible. Conditions do not match metadata types.')); } return $types; }