Exemplo n.º 1
0
 /**
  * Public attribute handler, setter override for database model. Handles
  * extra relations.
  *
  * @param string $name  Attribute handler
  * @param mixed  $value Value to be set
  * @return BasicModel
  * @see \System\Model\Attr::__set()
  */
 public function __set($attr, $value)
 {
     if ($this::has_attr($attr) && $this::is_rel($attr)) {
         $type = $this::get_attr_type($attr);
         if ($type == self::REL_HAS_MANY) {
             $this->set_rel_has_many($attr, $value);
         } else {
             $this->set_rel_single_value($attr, $value);
         }
         return $this;
     }
     if ($attr == 'id' || $attr == $this::get_id_col()) {
         $this->data[$this::get_id_col()] = intval($value);
     }
     return parent::__set($attr, $value);
 }