OphTrOperationnote_IOLPosition::model PHP Method

model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : ElementOperation
return ElementOperation the static model class
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

Usage Example

 /**
  * Validate IOL data if IOL is part of the element.
  *
  * @return bool
  */
 public function beforeValidate()
 {
     $iol_position = OphTrOperationnote_IOLPosition::model()->findByPk($this->iol_position_id);
     if (!$iol_position || $iol_position->name != 'None') {
         if (!$this->iol_type_id) {
             $this->addError('iol_type_id', 'IOL type cannot be blank');
         }
         if (!isset($this->iol_power)) {
             $this->addError('iol_power', 'IOL power cannot be blank');
         }
         /* elseif (!is_numeric($this->iol_power) || strlen(substr(strrchr($this->iol_power, "."), 1)) > 2 || ((-999.99 > $this->iol_power) || ($this->iol_power > 999.99))) {
                $this->addError('iol_power', 'IOL power must be a number with an optional two decimal places between -999.99 and 999.99');
              }
              elseif (strlen(substr(strrchr($this->iol_power, "."), 1)) > 2) {
                $this->addError('iol_power', 'IOL power must be a number with an optional two decimal places between -999.99 and 999.99');
            } elseif ((-999.99 > $this->iol_power) || ($this->iol_power > 999.99)) {
                $this->addError('iol_power', 'IOL power must be a number with an optional two decimal places between -999.99 and 999.99');
              } */
     }
     return parent::beforeValidate();
 }
All Usage Examples Of OphTrOperationnote_IOLPosition::model