Scalr\Model\AbstractEntity::__get PHP Method

__get() public method

public __get ( $prop )
    public function __get($prop)
    {
        if (strpos($prop, 'column') === 0) {
            $field = lcfirst(substr($prop, 6));
            if (!property_exists($this, $field)) {
                throw new BadMethodCallException(sprintf('Property "%s" does not exist in the class "%s".', $prop, get_class($this)));
            }
            return $this->_column($field);
        }
        return parent::__get($prop);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Magic getter.
  * Gets the values of the fields that require initialization.
  *
  * @param   string  $name   Name of property that is accessed
  *
  * @return  mixed   Returns property value
  */
 public function __get($name)
 {
     switch ($name) {
         case 'settings':
             if (empty($this->_settings)) {
                 $this->_settings = new SettingsCollection('Scalr\\Tests\\Fixtures\\Model\\Entity\\TestEntitySetting', [['testEntityId' => &$this->id]], ['testEntityId' => &$this->id]);
             }
             return $this->_settings;
         default:
             return parent::__get($name);
     }
 }
All Usage Examples Of Scalr\Model\AbstractEntity::__get