當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。