예제 #1
0
 public function &__get($name)
 {
     if (array_key_exists($name, $this->other)) {
         return $this->other[$name];
     }
     return parent::__get($name);
 }
예제 #2
0
 public function test___set02()
 {
     $item = new Object();
     $value = 'bar';
     $item->setFoo($value);
     $this->assertEquals($value, $item->__get('foo'));
 }
예제 #3
0
 function __get($name)
 {
     $prop = strtolower($name);
     if (in_array($prop, self::$Allowed)) {
         return isset($this->Properties[$prop]) ? $this->Properties[$prop] : null;
     }
     return parent::__get($name);
 }
예제 #4
0
 public function __get($key)
 {
     if (isset($this->_getters[$key])) {
         return $this->{$this->_getters[$key]}();
     } else {
         return parent::__get($key);
     }
 }
예제 #5
0
 /**
  * Shorthand to retrieve the inaccessible property.
  *
  * @param string $name The name of the property
  * @return mixed The value of the property.
  */
 public function __get($name)
 {
     try {
         $property = $this->reflector->getProperty($name);
         $property->setAccessible(true);
         return $property->getValue($this->object);
     } catch (ReflectionException $e) {
         return $this->object->__get($name);
     }
 }
예제 #6
0
 /**
  * Returns property value. Do not call directly.
  * support for models [e.g. rolesModel]
  * @param  string  property name
  * @return mixed   property value
  */
 public function &__get($name)
 {
     $className = ucfirst($name);
     if (String::endsWith($className, 'Model') && class_exists($className)) {
         if (!isset(self::$models[$className])) {
             self::$models[$className] = new $className();
         }
         return self::$models[$className];
     }
     return parent::__get($name);
 }
예제 #7
0
 public function __get($name)
 {
     if ($this->has($name)) {
         return $this->get($name);
     } else {
         return parent::__get($name);
     }
 }
예제 #8
0
파일: Object.php 프로젝트: brussens/cogear2
 /**
  * Magic __get method
  *
  * @param type $name
  */
 public function __get($name)
 {
     if ($this->elements->{$name}) {
         return $this->elements->{$name};
     }
     return parent::__get($name);
 }
예제 #9
0
파일: DbObject.php 프로젝트: rgigger/zinc
 /**
  * Automatic getter: maps unknown variables to database fields
  *
  * @param string $varname Name of the database field to get the value of
  * @return mixed Value of the given database field
  */
 public function __get($varname)
 {
     // check on inherited getters, setters, and mixins from Object
     if (parent::__isset($varname)) {
         return parent::__get($varname);
     }
     if ($this->hasRelationship($varname)) {
         return $this->getRelationshipInfo($varname);
     }
     return $this->getScalar($varname);
 }
예제 #10
0
	/**
	 * Обновляет данные в словаре
	 * @param $name String: Имя словаря
	 * @param $data Array: Данные для
	 */
	public function update($name, $new_data, $condition = array())
	{
		$name = strtolower($name);

		parent::__get("DB")->update($name, $new_data, $condition);

		$this->clear_cache($name);
	}
예제 #11
0
 /**
  * Fetch connected grapobjects and store in the property.
  *
  * @param string $property
  * @return mixed
  */
 function __get($property)
 {
     if (empty($this->id)) {
         return parent::__get($property);
     }
     $connections = $this->getKnownConnections();
     if (array_key_exists($property, $connections) === false) {
         // not a (known) connection?
         if ($this->_state === 'id_only') {
             $fields = Facebook::get($this->id, $this->_apiParameters);
             $this->__set($fields);
             $this->_state = 'ready';
             unset($this->_apiParameters);
             if (array_key_exists($property, $fields)) {
                 return $fields[$property];
             }
         }
         if ($this->_state === 'partial') {
             $fields = Facebook::get($this->id);
             $this->__set($fields);
             $this->_state = 'ready';
             if (array_key_exists($property, $fields)) {
                 return $fields[$property];
             }
         }
         $fields = get_public_vars(get_class($this));
         if (array_key_exists($property, $fields)) {
             // is the field defined in the class?
             $permissions = static::getFieldPermissions(array('id' => $this->id));
             if (isset($permissions[$property]) && $permissions[$property] !== 'denied' && in_array($permissions[$property], Facebook::getInstance()->getPermissions()) === false) {
                 notice('Field "' . $property . '" requires the "' . $permissions[$property] . '" permission', 'Current permissions: ' . quoted_human_implode(' and ', Facebook::getInstance()->getPermissions()));
             }
             return parent::__get($property);
         }
     }
     try {
         // Retrieve a connection
         if (isset($connections[$property]['class'])) {
             $parameters = array('fields' => call_user_func(array($connections[$property]['class'], 'getAllowedFields')));
         } else {
             $parameters = array();
         }
         $method = 'get' . ucfirst($property);
         $this->__set(array($property => $this->{$method}($parameters)));
         return $this->{$property};
     } catch (\Exception $e) {
         report_exception($e);
         return parent::__get($property);
     }
 }
예제 #12
0
 /**
  * Get a property
  *
  * Implement a virtual 'parameters' property to return the parameters object.
  *
  * @param   string $name  The property name.
  * @return  string $value The property value.
  */
 public function __get($name)
 {
     if ($name = 'parameters') {
         return $this->getParameters();
     }
     return parent::__get($name);
 }
예제 #13
0
 /**
  * Returns user data value.
  * @param  string  property name
  * @return mixed
  */
 public function &__get($key)
 {
     if ($key === 'name' || $key === 'roles') {
         return parent::__get($key);
     } else {
         return $this->data[$key];
     }
 }