public function &__get($key) { $column = $this->formatColumnName($key); if (parent::__isset($column) || !ObjectMixin::has($this, $key)) { return parent::__get($column); } else { return ObjectMixin::get($this, $key); } }
/** * @param $item * @param $valueName * @return mixed */ public function getItemValue($item, $valueName) { if (isset($this->columnAliases[$valueName])) { $getterPath = $this->columnAliases[$valueName]->getterPath; } else { $getterPath = $valueName; } $getters = explode('.', $getterPath); $value = $item; foreach ($getters as $getter) { $value = ObjectMixin::get($value, $getter); } return $value; }
/** * Returns property value. Do not call directly. * @param string property name * @return mixed property value * @throws Nette\MemberAccessException if the property is not defined. */ public function &__get($name) { return Nette\ObjectMixin::get($this, $name); }
Nette\ObjectMixin::call($this,$name,$args);}function&__get($name){return Nette\ObjectMixin::get($this,$name);}function
/** * Returns property value. Do not call directly. * * @param string property name * @return mixed property value * @throws MemberAccessException if the property is not defined. */ public function &__get($name) { try { $value = ObjectMixin::get($this, $name); return $value; } catch (\Nette\MemberAccessException $e) { $repository = self::em()->getRepository(static::class); $metadata = $repository->getMetadata(); // je to Column if ($metadata->hasColumn($name)) { // data zadana, je tento column inicializovan if (array_key_exists($name, $this->_data)) { $value = $this->_data[$name]; return $value; // PHP work-around (Only variable references should be returned by reference) } else { $defaults = $metadata->getDefaults(); // zkusme vratit default (column stale neinicializujeme) if (array_key_exists($name, $defaults)) { $value = $defaults[$name]; return $value; // PHP work-around (Only variable references should be returned by reference) } else { $value = NULL; return $value; // PHP work-around (Only variable references should be returned by reference) } } } elseif ($metadata->hasAssociation($name)) { // associace uz byla drive vytvorena, tak ji vratime if (array_key_exists($name, $this->_associations)) { $reference = $this->_associations[$name]; return $reference; } // associace k tomuto objektu neexistuje, vytvorime ji $reference = $this->_associations[$name] = $repository->createAssociatedObject($name, $this); return $reference; } // jde o chybu throw $e; } }
/** * Returns property value. Do not call directly. * * @param string property name * @return mixed property value * @throws MemberAccessException if the property is not defined. */ public function &__get($name) { try { $value = ObjectMixin::get($this, $name); return $value; } catch (\Nette\MemberAccessException $e) { $config = static::config(); if (!$config->hasColumn($name)) { if ($config->isAssociation($name)) { // associace uz byla drive vytvorena, tak ji vratime if (array_key_exists($name, $this->_associations)) { $reference = $this->_associations[$name]; return $reference; } // jak vidno vytvorena jeste nebyla zjistime o jaky typ se jedna $reference = $this->_associations[$name] = $config->getAssociation($name)->retrieveReferenced($this); return $reference; } throw $e; } if (array_key_exists($name, $this->_data)) { $value = $this->_data[$name]; return $value; // PHP work-around (Only variable references should be returned by reference) } else { $defaults = $config->getDefaults(); if (array_key_exists($name, $defaults)) { $value = $defaults[$name]; return $value; // PHP work-around (Only variable references should be returned by reference) } else { $value = NULL; return $value; // PHP work-around (Only variable references should be returned by reference) } } } }
public function &__get($name) { foreach ($this->getExtensions() as $extension) { /* @var $extension ExtensionObject */ if ($extension->getReflection()->hasProperty($name)) { $property = $extension->getReflection()->getProperty($name); if ($property->isPublic() && !$property->isStatic()) { return $extension->{$name}; } } if (ObjectMixin::has($extension, $name)) { return ObjectMixin::get($extension, $name); } } return parent::__get($name); }