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


PHP PropertyAccess::getValue方法代码示例

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


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

示例1: current

 /**
  * {@inheritdoc}
  */
 public function current()
 {
     $current = $this->iterator->current();
     $data = array();
     foreach ($this->propertyPaths as $name => $propertyPath) {
         $data[$name] = $this->getValue($this->propertyAccessor->getValue($current, $propertyPath));
     }
     return $data;
 }
开发者ID:LamaDelRay,项目名称:test_symf,代码行数:12,代码来源:PropelCollectionSourceIterator.php

示例2: current

 /**
  * {@inheritdoc}
  */
 public function current()
 {
     $current = $this->iterator->current();
     $data = array();
     foreach ($this->propertyPaths as $name => $propertyPath) {
         $data[$name] = $this->getValue($this->propertyAccessor->getValue($current, $propertyPath));
     }
     $this->query->getDocumentManager()->getUnitOfWork()->detach($current);
     return $data;
 }
开发者ID:kazak,项目名称:forum,代码行数:13,代码来源:DoctrineODMQuerySourceIterator.php

示例3: current

 /**
  * {@inheritdoc}
  */
 public function current()
 {
     $current = $this->iterator->current();
     $data = array();
     foreach ($this->propertyPaths as $name => $propertyPath) {
         try {
             $data[$name] = $this->getValue($this->propertyAccessor->getValue($current[0], $propertyPath));
         } catch (UnexpectedTypeException $e) {
             //non existent object in path will be ignored
             $data[$name] = null;
         }
     }
     $this->query->getEntityManager()->getUnitOfWork()->detach($current[0]);
     return $data;
 }
开发者ID:LamaDelRay,项目名称:test_symf,代码行数:18,代码来源:DoctrineORMQuerySourceIterator.php

示例4: accessValue

 /**
  * Internal helper method that is used to retrieve an underlying value from a given context (object/array).
  * If the given context is scalar, it is returned as the resulting value.
  *
  * @param mixed $context The context to retrieve the value from.
  * @param string $key The property-name/array-key to use in order to read the value from the $context.
  *
  * @return mixed
  */
 protected function accessValue($context, $key)
 {
     if (is_array($context)) {
         return $this->accessor->getValue($context, "[{$key}]");
     } elseif (is_object($context)) {
         return $this->accessor->getValue($context, $key);
     } else {
         return $context;
     }
 }
开发者ID:shrink0r,项目名称:monatic,代码行数:19,代码来源:Maybe.php

示例5: addItems

 /**
  * @param Sitemap $sitemap
  * @param $route
  * @param array $parametersCollection
  * @param array $routeConfigurations
  */
 protected function addItems(Sitemap $sitemap, $route, array $parametersCollection, array $routeConfigurations)
 {
     $progress = new ProgressBar($this->output, count($parametersCollection));
     $progress->start();
     foreach ($parametersCollection as $parameters) {
         $sitemap->addItem($this->router->generate($route, $this->accessor->getValue($parameters, '[route_params]') ?: $parameters, true), $this->accessor->getValue($parameters, '[sitemap_optional_tags][lastmod]') ?: $routeConfigurations['lastmod'], $this->accessor->getValue($parameters, '[sitemap_optional_tags][changefreq]') ?: $routeConfigurations['changefreq'], $this->accessor->getValue($parameters, '[sitemap_optional_tags][priority]') ?: $routeConfigurations['priority']);
         $progress->advance();
     }
     $progress->finish();
     $this->output->writeln('');
 }
开发者ID:skuola,项目名称:SitemapBundle,代码行数:17,代码来源:SitemapGeneratorCommand.php

示例6: export

 /**
  * {@inheritDoc}
  */
 public function export(IdentityInterface $identity)
 {
     if (!$this->handle($identity)) {
         throw new Error(sprintf("Trying to handle identity of type '%s' with a factory designed for '%s'", get_class($identity), $this->classFQN));
     }
     $identityArr = array();
     $class = $this->getIdentityReflection($identity);
     $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
     $properties = $class->getproperties();
     foreach ($methods as $method) {
         $annotations = $this->reader->getMethodAnnotations($method);
         foreach ($annotations as $annotation) {
             switch (true) {
                 case $annotation instanceof Identity:
                     if (!empty($annotation->name) && $annotation->type == 'getter') {
                         $identityArr[$annotation->name] = $method->invoke($identity);
                     }
                     break;
             }
         }
     }
     foreach ($properties as $property) {
         $annotations = $this->reader->getPropertyAnnotations($property);
         foreach ($annotations as $annotation) {
             switch (true) {
                 case $annotation instanceof Identity:
                     if (empty($annotation->name)) {
                         $annotation->name = $property->getName();
                     }
                     $identityArr[$annotation->name] = $this->accessor->getValue($identity, $property->getName());
                     break;
             }
         }
     }
     return $identityArr;
 }
开发者ID:AdrenalineHunter,项目名称:AWSBundle,代码行数:39,代码来源:GenericIdentityFactory.php

示例7: getValue

 /**
  * @param object $entity
  * @param string $path
  *
  * @return mixed
  */
 protected function getValue($entity, $path)
 {
     return $this->accessor->getValue($entity, $path);
 }
开发者ID:dairdr,项目名称:crm,代码行数:10,代码来源:AbstractReverseProcessor.php


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