Beispiel #1
0
 /**
  * Get the rateToBase from the currency model. If the scenario is importModel, then having a rateToBase
  * manually set is ok.
  * @return true to signal success and that validate can proceed.
  */
 public function beforeValidate()
 {
     if (!parent::beforeValidate()) {
         return false;
     }
     if ($this->currency->rateToBase !== null && ($this->rateToBase === null || array_key_exists('value', $this->originalAttributeValues) || array_key_exists('currency', $this->originalAttributeValues)) && !($this->getScenario() == 'importModel' && $this->rateToBase != null)) {
         $this->rateToBase = $this->currency->rateToBase;
         assert('$this->rateToBase !== null');
     }
     return true;
 }