当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectMixin::get方法代码示例

本文整理汇总了PHP中Nette\ObjectMixin::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectMixin::get方法的具体用法?PHP ObjectMixin::get怎么用?PHP ObjectMixin::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nette\ObjectMixin的用法示例。


在下文中一共展示了ObjectMixin::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 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);
     }
 }
开发者ID:fabik,项目名称:database,代码行数:9,代码来源:ActiveRow.php

示例2: getItemValue

 /**
  * @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;
 }
开发者ID:natrim,项目名称:gridito,代码行数:19,代码来源:DoctrineQueryBuilderModel.php

示例3:

 /**
  * 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);
 }
开发者ID:genextwebs,项目名称:dropbox-sample,代码行数:10,代码来源:CachingIterator.php

示例4:

Nette\ObjectMixin::call($this,$name,$args);}function&__get($name){return
Nette\ObjectMixin::get($this,$name);}function
开发者ID:JanTvrdik,项目名称:NetteExtras,代码行数:2,代码来源:loader.php

示例5: catch

 /**
  * 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;
     }
 }
开发者ID:matak,项目名称:dbrecord,代码行数:49,代码来源:Entity.php

示例6: catch

 /**
  * 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)
             }
         }
     }
 }
开发者ID:matak,项目名称:dbrecord,代码行数:45,代码来源:DbRecord.php

示例7: foreach

 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);
 }
开发者ID:jsmitka,项目名称:ExtensionObjects,代码行数:16,代码来源:ExtensibleObject.php


注:本文中的Nette\ObjectMixin::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。