/**
  * @param string $tableAliasName
  * @return string
  */
 protected function getAttributeClauseQueryStringExtraPart($tableAliasName)
 {
     assert('is_string($tableAliasName)');
     if ($this->componentForm->isATypeOfCurrencyValue() && ($this->currencyConversionType == Report::CURRENCY_CONVERSION_TYPE_BASE || $this->currencyConversionType == Report::CURRENCY_CONVERSION_TYPE_SPOT)) {
         $quote = DatabaseCompatibilityUtil::getQuote();
         $currencyValue = new CurrencyValue();
         return " * {$quote}{$tableAliasName}{$quote}." . "{$quote}" . $currencyValue->getColumnNameByAttribute('rateToBase') . "{$quote}";
     }
 }
 /**
  * Resolves for a given component whether the user has necessary rights to access the component information.
  * An example is if a component is account's opportunities and the current user cannot access the opportunities
  * module.
  * @param ComponentForReportForm $componentForm
  * @return bool
  */
 protected static function canCurrentUserAccessComponent(ComponentForReportForm $componentForm)
 {
     $modelClassName = $componentForm->getModelClassName();
     $moduleClassName = $componentForm->getModuleClassName();
     if (!$componentForm->hasRelatedData()) {
         return self::canCurrentUserCanAccessModule($moduleClassName);
     } else {
         foreach ($componentForm->attributeAndRelationData as $relationOrAttribute) {
             if (!self::canCurrentUserCanAccessModule($moduleClassName)) {
                 return false;
             }
             $modelToReportAdapter = ModelRelationsAndAttributesToReportAdapter::make($moduleClassName, $modelClassName, $componentForm->getReportType());
             if ($modelToReportAdapter->isReportedOnAsARelation($relationOrAttribute)) {
                 $modelClassName = $modelToReportAdapter->getRelationModelClassName($relationOrAttribute);
                 $moduleClassName = $modelToReportAdapter->getRelationModuleClassName($relationOrAttribute);
             }
         }
         return true;
     }
 }
 /**
  * @see resolveAttributeIndexesByComponents
  * @param ComponentForReportForm $componentForm
  * @return array
  */
 protected static function resolveAttributeIndexesByComponent(ComponentForReportForm $componentForm)
 {
     $attributeIndexes = array();
     $modelClassName = $componentForm->getModelClassName();
     $moduleClassName = $componentForm->getModuleClassName();
     if (!$componentForm->hasRelatedData()) {
         static::resolveAttributeIndexes($modelClassName, $attributeIndexes);
     } else {
         $attributeIndexPrefix = null;
         foreach ($componentForm->attributeAndRelationData as $relationOrAttribute) {
             static::resolveAttributeIndexes($modelClassName, $attributeIndexes, $attributeIndexPrefix);
             $modelToReportAdapter = ModelRelationsAndAttributesToReportAdapter::make($moduleClassName, $modelClassName, $componentForm->getReportType());
             if ($modelToReportAdapter->isReportedOnAsARelation($relationOrAttribute)) {
                 $modelClassName = $modelToReportAdapter->getRelationModelClassName($relationOrAttribute);
                 $moduleClassName = $modelToReportAdapter->getRelationModuleClassName($relationOrAttribute);
                 $attributeIndexPrefix = $attributeIndexPrefix . $relationOrAttribute . FormModelUtil::RELATION_DELIMITER;
             }
         }
     }
     return $attributeIndexes;
 }
 /**
  * @return array
  */
 public function rules()
 {
     return array_merge(parent::rules(), array(array('operator', 'type', 'type' => 'string'), array('operator', 'validateOperator'), array('value', 'safe'), array('value', 'validateValue'), array('secondValue', 'safe'), array('secondValue', 'validateSecondValue'), array('currencyIdForValue', 'safe'), array('stringifiedModelForValue', 'safe'), array('availableAtRunTime', 'boolean'), array('valueType', 'type', 'type' => 'string'), array('valueType', 'validateValueType')));
 }
 /**
  * @return array
  */
 public function rules()
 {
     return array_merge(parent::rules(), array(array('axis', 'required'), array('axis', 'type', 'type' => 'string'), array('axis', 'validateAxis')));
 }
 /**
  * @param string $name
  * @param mixed $value
  */
 public function __set($name, $value)
 {
     parent::__set($name, $value);
     if ($name == 'attributeIndexOrDerivedType') {
         $this->label = $this->getDisplayLabel();
     }
 }
 /**
  * @param ComponentForReportForm $componentForm
  * @return ModelRelationsAndAttributesToReportAdapter
  */
 protected static function makeModelToReportAdapterByComponentForm(ComponentForReportForm $componentForm)
 {
     return ModelRelationsAndAttributesToReportAdapter::make($componentForm->getResolvedAttributeModuleClassName(), $componentForm->getResolvedAttributeModelClassName(), $componentForm->getReportType());
 }