/** * @return array * @throws NotSupportedException if the attributeIndexOrDerivedType has not been populated yet */ public function getOperatorValuesAndLabels() { if ($this->attributeIndexOrDerivedType == null) { throw new NotSupportedException(); } $type = $this->getAvailableOperatorsType(); $data = array(); ModelAttributeToReportOperatorTypeUtil::resolveOperatorsToIncludeByType($data, $type); return $data; }
/** * @param string $attribute * @return null|string * @throws NotSupportedException if the attribute is a derived attribute */ public function getAvailableOperatorsType($attribute) { assert('is_string($attribute)'); if ($this->isDynamicallyDerivedAttribute($attribute)) { return ModelAttributeToReportOperatorTypeUtil::AVAILABLE_OPERATORS_TYPE_HAS_ONE; } if ($this->isDerivedAttribute($attribute)) { throw new NotSupportedException(); } $resolvedAttribute = static::resolveRealAttributeName($attribute); if (null != ($availableOperatorsTypeFromRule = $this->rules->getAvailableOperatorsTypes($this->model, $resolvedAttribute))) { return $availableOperatorsTypeFromRule; } return ModelAttributeToReportOperatorTypeUtil::getAvailableOperatorsType($this->model, $resolvedAttribute); }