Nette\Database\Table\ActiveRow::__get PHP Method

__get() public method

public __get ( $key ) : ActiveRow | mixed
return ActiveRow | mixed
    public function &__get($key)
    {
        if ($this->accessColumn($key)) {
            return $this->data[$key];
        }
        $referenced = $this->table->getReferencedTable($this, $key);
        if ($referenced !== FALSE) {
            $this->accessColumn($key, FALSE);
            return $referenced;
        }
        $this->removeAccessColumn($key);
        $hint = Nette\Utils\ObjectMixin::getSuggestion(array_keys($this->data), $key);
        throw new Nette\MemberAccessException("Cannot read an undeclared column '{$key}'" . ($hint ? ", did you mean '{$hint}'?" : '.'));
    }

Usage Example

Beispiel #1
0
 /**
  * Returns value of column / referenced row
  *
  * @param $key
  * @return mixed|HyperRow|HyperSelection
  */
 public function &__get($key)
 {
     // Try to get method - getter
     if (ObjectMixin::has($this, $key)) {
         return ObjectMixin::get($this, $key);
     }
     // Otherwise get ActiveRow property
     $result = $this->activeRow->__get($key);
     if ($result instanceof ActiveRow) {
         $hyperrow = $this->factory->createRow($result, $result->getTable()->getName());
         return $hyperrow;
     }
     return $result;
 }
All Usage Examples Of Nette\Database\Table\ActiveRow::__get