コード例 #1
0
ファイル: newsfeeditem.php プロジェクト: anqqa/Anqh
 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     if ($key == 'data') {
         $value = is_null($value) ? null : json_encode($value);
     }
     parent::__set($key, $value);
 }
コード例 #2
0
ファイル: forum_area.php プロジェクト: anqqa/Anqh
 /**
  * Handles setting of all model values, and tracks changes between values.
  *
  * @param   string  column name
  * @param   mixed   column value
  * @return  void
  */
 public function __set($column, $value)
 {
     switch ($column) {
         // Set access type
         case 'area_type':
             $types = self::area_types();
             if (!isset($types[$value])) {
                 throw new Kohana_Exception('The area type :type does not exist in the :class class', array(':type' => $value, ':class' => get_class($this)));
             }
             $old_access = $this->__get('access');
             parent::__set('access', $old_access | $value);
             break;
         default:
             parent::__set($column, $value);
     }
 }
コード例 #3
0
ファイル: user.php プロジェクト: anqqa/Anqh
 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
             // Use Auth to hash the password
         // Use Auth to hash the password
         case 'password':
             $value = Visitor::instance()->hash_password($value);
             break;
     }
     parent::__set($key, $value);
 }