Esempio n. 1
0
 /**
  * Call to undefined method.
  * @param  string  method name
  * @param  array   arguments
  * @return mixed
  * @throws MemberAccessException
  */
 public function __call($name, $args)
 {
     $class = new Nette\Reflection\ClassType($this);
     if ($name === '') {
         throw new Nette\MemberAccessException("Call to class '{$class->name}' method without name.");
     }
     // event functionality
     if ($class->hasProperty($name)) {
         if (!$this->_eventSetupCalled) {
             $this->_eventSetupCalled = true;
             $this->eventSetup();
             $this->onEventSetup($this);
         }
         if (is_array($list = $this->{$name}) || $list instanceof \Traversable) {
             foreach ($list as $handler) {
                 callback($handler)->invokeArgs($args);
             }
         }
         return NULL;
     }
     // extension methods
     if ($cb = Nette\ObjectMixin::getExtensionMethod(get_class($this), $name)) {
         array_unshift($args, $this);
         return $cb->invokeArgs($args);
     }
     throw new Nette\MemberAccessException("Call to undefined method {$class->name}::{$name}().");
 }
Esempio n. 2
0
 public function __unset($key)
 {
     $column = $this->formatColumnName($key);
     if (parent::__isset($column) || !ObjectMixin::has($this, $key)) {
         parent::__unset($column);
     } else {
         ObjectMixin::remove($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;
 }
 public function __call($name, $args)
 {
     return Nette\ObjectMixin::callProperty($this, $name, $args);
 }
 /**
  * Access to undeclared property.
  * @param  string  property name
  * @return void
  * @throws Nette\MemberAccessException
  */
 public function __unset($name)
 {
     Nette\ObjectMixin::remove($this, $name);
 }
 public function __isset($name)
 {
     return ObjectMixin::has($this, $name);
 }
Esempio n. 7
0
 /**
  * @param $method
  * @param $args
  */
 public function __call($method, $args)
 {
     ObjectMixin::call($this, $method, $args);
 }
Esempio n. 8
0
Nette\Object{public$name;public$value;public$static;public$visibility='public';public$documents=array();function
__call($name,$args){return
Nette\ObjectMixin::callProperty($this,$name,$args);}}}namespace Nette\Utils{use
Esempio n. 9
0
 /**
  * Is property defined?
  *
  * @param  string  property name
  * @return bool
  */
 public function __isset($name)
 {
     return ObjectMixin::has($this, $name) ? TRUE : (isset($this->_data[$name]) ? TRUE : array_key_exists($name, $this->_associations));
 }
 public function __set($name, $value)
 {
     foreach ($this->getExtensions() as $extension) {
         /* @var $extension ExtensionObject */
         if ($extension->getReflection()->hasProperty($name)) {
             $property = $extension->getReflection()->getProperty($name);
             if ($property->isPublic() && !$property->isStatic()) {
                 $extension->{$name} = $value;
                 return;
             }
         }
         if (ObjectMixin::has($extension, $name)) {
             ObjectMixin::set($extension, $name, $value);
             return;
         }
     }
     return parent::__set($name, $value);
 }