public function __construct($modelClassName, $modelAttributeName)
 {
     assert($modelClassName == "User");
     // Not Coding Standard
     parent::__construct($modelClassName, $modelAttributeName);
     $this->statusData = UserStatusUtil::getStatusArray();
 }
 /**
  * For this class, the $derivedAttributeType also happens to be the modelClassName.  In order to use this
  * class you must ensure the $derivedAttributeType coming into this method is a valid model class name.
  * @param unknown_type $modelClassName
  * @param string $derivedAttributeType
  */
 public function __construct($modelClassName, $derivedAttributeType)
 {
     parent::__construct($modelClassName, $derivedAttributeType);
     $relationModelClassName = substr($derivedAttributeType, 0, strlen($derivedAttributeType) - strlen('Derived'));
     assert('class_exists($relationModelClassName)');
     $defaultModuleClassName = $relationModelClassName::getModuleClassName();
     $this->moduleIdOfDefaultModel = $defaultModuleClassName::getDirectoryName();
 }
コード例 #3
0
 public function rules()
 {
     if ($this->getScenario() == 'extraColumn') {
         $requiredRuleIsApplicable = true;
     } else {
         $requiredRuleIsApplicable = false;
     }
     $defaultValueApplicableModelAttributeRules = ModelAttributeRulesToDefaultValueMappingRuleUtil::getApplicableRulesByModelClassNameAndAttributeName($this->modelClassName, 'state', static::getAttributeName(), $requiredRuleIsApplicable);
     return array_merge(parent::rules(), $defaultValueApplicableModelAttributeRules);
 }
 public function rules()
 {
     if ($this->getScenario() == 'extraColumn') {
         $requiredRuleIsApplicable = true;
     } else {
         $requiredRuleIsApplicable = false;
     }
     $defaultValueApplicableModelAttributeRules = ModelAttributeRulesToDefaultValueMappingRuleUtil::getApplicableRulesByModelClassNameAndAttributeName($this->modelClassName, 'hash', static::getAttributeName(), $requiredRuleIsApplicable);
     //Remove the has length rule
     foreach ($defaultValueApplicableModelAttributeRules as $index => $rule) {
         if ($rule[1] == 'length') {
             unset($defaultValueApplicableModelAttributeRules[$index]);
         }
     }
     return array_merge(parent::rules(), $defaultValueApplicableModelAttributeRules);
 }