src/Titon/Model/Model.php
public function get($key) {
        $value = null;

        // If the key already exists in the attribute list, return it immediately
        if ($this->has($key)) {
            $value = $this->_attributes[$key];
        }

        // If the key being accessed points to a relation, either lazy load the data or return the cached data
        if (!$value && $this->hasRelation($key)) {
            $value = $this->getRelation($key)->fetchRelation();

            $this->set($key, $value);

        // If an accessor has been defined, run the value through the accessor before returning
        } else if ($method = $this->hasAccessor($key)) {
            $value = $this->{$method}($value);
        }

        return $value;
    }
public function get($key) {
        $value = null;

        // If the key already exists in the attribute list, return it immediately
        if ($this->has($key)) {
            $value = $this->_attributes[$key];
        }

        // If the key being accessed points to a relation, either lazy load the data or return the cached data
        if (!$value && $this->hasRelation($key)) {
            $value = $this->getRelation($key)->fetchRelation();

            $this->set($key, $value);

        // If an accessor has been defined, run the value through the accessor before returning
        } else if ($method = $this->hasAccessor($key)) {
            $value = $this->{$method}($value);
        }

        return $value;
    }
public function get ( $ key ) { $ value = null ; // If the key already exists in the attribute list, return it immediately if ( $ this -> has ( $ key ) ) { $ value = $ this -> _attributes [ $ key ] ; } // If the key being accessed points to a relation, either lazy load the data or return the cached data if ( ! $ value && $ this -> hasRelation ( $ key ) ) { $ value = $ this -> getRelation ( $ key ) -> fetchRelation ( ) ; $ this -> set ( $ key , $ value ) ; // If an accessor has been defined, run the value through the accessor before returning } else if ( $ method = $ this -> hasAccessor ( $ key ) ) { $ value = $ this -> { $ method } ( $ value ) ; } return $ value ; }
Get an attribute on the model. If the attribute points to a relation,
fetch the related records through the relation object.
If an accessor is defined, pass the non-relation attribute through it.

@param string $key
@return mixed
Get an attribute on the model . If the attribute points to a relation fetch the related records through the relation object . If an accessor is defined pass the non - relation attribute through it .