コード例 #1
0
ファイル: User.php プロジェクト: mynameiszanders/yiiskeleton
 /**
  * PHP Magic Function: Set
  *
  * Override the method to extend the functionality (hash a password that is set as an attribute before adding it
  * to the model).
  *
  * @access public
  * @param string $name
  * @param mixed $value
  * @return void
  */
 public function __set($property, $value)
 {
     // If an override method exists for a certain property, call it to alter the value before passing it to the
     // model to be saved to the database.
     $method = 'set' . ucwords($property);
     if (method_exists($this, $method)) {
         $value = $this->{$method}($value);
     }
     // Carry on setting it to the model as normal.
     parent::__set($property, $value);
 }
コード例 #2
0
 /**
  * Model Instance
  *
  * Returns a static model of the specified ActiveRecord class. This exact method should be in all classes that
  * extend CActiveRecord.
  *
  * @access public
  * @param string $class_name
  * @return FailedLogin
  */
 public static function model($class_name = __CLASS__)
 {
     return parent::model($class_name);
 }