Example #1
0
 public function __get($key)
 {
     if ($key == 'author') {
         return ORM::factory('user')->find_user($this->author_id);
     } else {
         return parent::__get($key);
     }
 }
Example #2
0
 /**
  * Magic getter
  *
  * @param  string  $key
  */
 public function __get($key)
 {
     $value = parent::__get($key);
     if ($key == 'data') {
         $value = is_null($value) ? null : json_decode($value, true);
     }
     return $value;
 }
Example #3
0
 /**
  * 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);
     }
 }
Example #4
0
File: tag.php Project: anqqa/Anqh
 public function __construct($id = null)
 {
     parent::__construct($id);
     $this->form = array('id' => array('input' => array('type' => 'hidden')), 'tag_group_id' => array('input' => array('type' => 'hidden')), 'name' => array('input' => array('maxlength' => 32), 'label' => Kohana::lang('tags.group_name')), 'description' => array('input' => array('maxlength' => 250), 'label' => Kohana::lang('tags.group_description')));
 }
Example #5
0
File: user.php Project: anqqa/Anqh
 /**
  * Allows a model to be loaded by username or email address.
  *
  * @param   mixed  $id  id, username, email
  * @return  string
  */
 public function unique_key($id)
 {
     if (!empty($id) && is_string($id) && !ctype_digit($id)) {
         return valid::email($id) ? 'email' : 'username';
     }
     return parent::unique_key($id);
 }