Example #1
0
 /**
  * PHP getter magic method.
  * This method is overridden so that AR attributes can be accessed like properties.
  * @param string property name
  * @return mixed property value
  * @see getAttribute
  */
 public function __get($name)
 {
     if (isset($this->_attributes[$name])) {
         return $this->_attributes[$name];
     } else {
         if (isset($this->getMetaData()->columns[$name])) {
             return null;
         } else {
             if (isset($this->_related[$name])) {
                 return $this->_related[$name];
             } else {
                 if (isset($this->getMetaData()->relations[$name])) {
                     return $this->getRelated($name);
                 } else {
                     return parent::__get($name);
                 }
             }
         }
     }
 }