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


PHP ObjectAccess::getPropertyPath方法代码示例

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


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

示例1: render

 /**
  * @param string $propertyName
  * @param mixed $object
  * @return mixed
  */
 public function render($propertyName, $subject = NULL)
 {
     if ($subject === NULL) {
         $subject = $this->renderChildren();
     }
     return \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($subject, $propertyName);
 }
开发者ID:plobacher,项目名称:extbasebookexample,代码行数:12,代码来源:PropertyViewHelper.php

示例2: getOptions

 /**
  * Render the option tags.
  *
  * @param $optionOverride added by nnaddress
  * @return array an associative array of options, key will be the value of the option tag
  */
 protected function getOptions($optionOverride = NULL)
 {
     if (!$this->arguments['renderSubGroups']) {
         return parent::getOptions();
     }
     if (!is_array($this->arguments['options']) && !$this->arguments['options'] instanceof \Traversable) {
         return array();
     }
     $options = array();
     $optionsArgument = $optionOverride ? $optionOverride : $this->arguments['options'];
     foreach ($optionsArgument as $key => $value) {
         if (is_object($value)) {
             // Added by NN Address
             $childOptions = $this->getOptions($value->getChildGroups());
             if ($this->hasArgument('optionValueField')) {
                 $key = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($value, $this->arguments['optionValueField']);
                 if (is_object($key)) {
                     if (method_exists($key, '__toString')) {
                         $key = (string) $key;
                     } else {
                         throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Identifying value for object of class "' . get_class($value) . '" was an object.', 1247827428);
                     }
                 }
                 // TODO: use $this->persistenceManager->isNewObject() once it is implemented
             } elseif ($this->persistenceManager->getIdentifierByObject($value) !== NULL) {
                 $key = $this->persistenceManager->getIdentifierByObject($value);
             } elseif (method_exists($value, '__toString')) {
                 $key = (string) $value;
             } else {
                 throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('No identifying value for object of class "' . get_class($value) . '" found.', 1247826696);
             }
             if ($this->hasArgument('optionLabelField')) {
                 $value = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($value, $this->arguments['optionLabelField']);
                 if (is_object($value)) {
                     if (method_exists($value, '__toString')) {
                         $value = (string) $value;
                     } else {
                         throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Label value for object of class "' . get_class($value) . '" was an object without a __toString() method.', 1247827553);
                     }
                 }
             } elseif (method_exists($value, '__toString')) {
                 $value = (string) $value;
                 // TODO: use $this->persistenceManager->isNewObject() once it is implemented
             } elseif ($this->persistenceManager->getIdentifierByObject($value) !== NULL) {
                 $value = $this->persistenceManager->getIdentifierByObject($value);
             }
         }
         $options[$key] = $value;
         // Added by NN Address
         if (sizeof($childOptions) > 0) {
             $options = $options + $childOptions;
         }
     }
     if ($this->arguments['sortByOptionLabel']) {
         asort($options, SORT_LOCALE_STRING);
     }
     return $options;
 }
开发者ID:Tricept,项目名称:nn_address,代码行数:64,代码来源:SelectViewHelper.php

示例3: filter

 /**
  * Filter an item/value according to desired filter. Returns TRUE if
  * the item should be included, FALSE otherwise. This default method
  * simply does a weak comparison (==) for sameness.
  *
  * @param mixed $item
  * @param mixed $filter Could be a single value or an Array. If so the function returns TRUE when $item matches with any value in it.
  * @param string $propertyName
  * @return boolean
  */
 protected function filter($item, $filter, $propertyName)
 {
     if (FALSE === empty($propertyName) && (TRUE === is_object($item) || TRUE === is_array($item))) {
         $value = ObjectAccess::getPropertyPath($item, $propertyName);
     } else {
         $value = $item;
     }
     return is_array($filter) ? in_array($value, $filter) : $value == $filter;
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:19,代码来源:FilterViewHelper.php

示例4: render

 /**
  * @param string $name
  * @return string
  */
 public function render($name)
 {
     if (strpos($name, '.') === FALSE) {
         return $this->templateVariableContainer->get($name);
     } else {
         $parts = explode('.', $name);
         return ObjectAccess::getPropertyPath($this->templateVariableContainer->get(array_shift($parts)), implode('.', $parts));
     }
 }
开发者ID:JostBaron,项目名称:flux,代码行数:13,代码来源:VariableViewHelper.php

示例5: getByPath

 /**
  * Returns the settings at path $path, which is separated by ".",
  * e.g. "pages.uid".
  * "pages.uid" would return $this->settings['pages']['uid'].
  *
  * If the path is invalid or no entry is found, false is returned.
  *
  * @param string $path
  * @return mixed
  */
 public function getByPath($path)
 {
     $configuration = $this->getConfiguration();
     $setting = ObjectAccess::getPropertyPath($configuration, $path);
     if ($setting === NULL) {
         $setting = ObjectAccess::getPropertyPath($configuration['settings'], $path);
     }
     return $setting;
 }
开发者ID:raphaelweber,项目名称:sf_simple_faq,代码行数:19,代码来源:SettingsService.php

示例6: convertFromArray

 /**
  * @param array $objects
  * @param array $propertyNames
  * @return string
  */
 public function convertFromArray(array $objects, array $propertyNames)
 {
     $result = '';
     $columnNames = array();
     foreach ($propertyNames as $propertyName) {
         $columnNames[] = $this->escapeValue($propertyName);
     }
     $result .= implode(';', $columnNames) . chr(10);
     foreach ($objects as $object) {
         $cells = array();
         foreach ($propertyNames as $propertyName) {
             $cells[] = $this->escapeValue(ObjectAccess::getPropertyPath($object, $propertyName));
         }
         $result .= implode(';', $cells) . chr(10);
     }
     return $result;
 }
开发者ID:vertexvaar,项目名称:election,代码行数:22,代码来源:CsvUtility.php

示例7: __construct

 /**
  * @return ImageRendererConfiguration
  */
 public function __construct()
 {
     if (isset($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fluid_styled_responsive_images'])) {
         $extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fluid_styled_responsive_images']);
         if (!is_array($extensionConfiguration)) {
             $extensionConfiguration = ['enableSmallDefaultImage' => true];
         }
         $this->extensionConfiguration = filter_var_array($extensionConfiguration, ['enableSmallDefaultImage' => FILTER_VALIDATE_BOOLEAN], false);
     }
     $this->settings = [];
     $this->typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
     $this->tagBuilder = GeneralUtility::makeInstance(TagBuilder::class);
     $configuration = $this->typoScriptService->convertTypoScriptArrayToPlainArray($this->getTypoScriptSetup());
     $settings = ObjectAccess::getPropertyPath($configuration, 'tt_content.textmedia.settings.responsive_image_rendering');
     $settings = is_array($settings) ? $settings : [];
     $this->settings['layoutKey'] = isset($settings['layoutKey']) ? $settings['layoutKey'] : 'default';
     $this->settings['sourceCollection'] = isset($settings['sourceCollection']) && is_array($settings['sourceCollection']) ? $settings['sourceCollection'] : [];
 }
开发者ID:alexanderschnitzler,项目名称:fluid-styled-responsive-images,代码行数:21,代码来源:ImageRendererConfiguration.php

示例8: getTypoScriptOverrides

 /**
  * @param string $qualifiedExtensionName
  * @return array
  */
 protected function getTypoScriptOverrides($qualifiedExtensionName)
 {
     if (static::$overrides === NULL) {
         $collected = array();
         $typoScript = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Extbase\\Object\\ObjectManagerInterface')->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
         foreach ((array) ObjectAccess::getPropertyPath($typoScript, 'plugin') as $prefix => $pluginSettings) {
             if (!empty($pluginSettings['package'])) {
                 $collected[substr($prefix, 3)] = $pluginSettings['package'];
             }
         }
         static::$overrides = $collected;
     }
     $packageSignature = ExtensionNamingUtility::getExtensionSignature($qualifiedExtensionName);
     if (!empty(static::$overrides[$packageSignature])) {
         return static::$overrides[$packageSignature];
     }
     return array();
 }
开发者ID:fluidtypo3,项目名称:flux,代码行数:22,代码来源:FluxPackageFactory.php

示例9: renderStatic

 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  * @return mixed
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $extensionKey = $arguments['extensionKey'];
     $path = $arguments['path'];
     if (null === $extensionKey) {
         $extensionName = $renderingContext->getControllerContext()->getRequest()->getControllerExtensionName();
         $extensionKey = GeneralUtility::camelCaseToLowerCaseUnderscored($extensionName);
     }
     if (!array_key_exists($extensionKey, $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'])) {
         return null;
     } elseif (!array_key_exists($extensionKey, static::$configurations)) {
         $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$extensionKey]);
         static::$configurations[$extensionKey] = GeneralUtility::removeDotsFromTS($extConf);
     }
     if (!$path) {
         return static::$configurations[$extensionKey];
     }
     return ObjectAccess::getPropertyPath(static::$configurations[$extensionKey], $path);
 }
开发者ID:fluidtypo3,项目名称:vhs,代码行数:25,代码来源:ExtensionConfigurationViewHelper.php

示例10: render

 /**
  * @param string $name
  * @param boolean $useRawKeys
  * @return mixed
  */
 public function render($name, $useRawKeys = FALSE)
 {
     if (FALSE === strpos($name, '.')) {
         if (TRUE === $this->templateVariableContainer->exists($name)) {
             return $this->templateVariableContainer->get($name);
         }
     } else {
         $segments = explode('.', $name);
         $lastSegment = array_shift($segments);
         $templateVariableRootName = $lastSegment;
         if (TRUE === $this->templateVariableContainer->exists($templateVariableRootName)) {
             $templateVariableRoot = $this->templateVariableContainer->get($templateVariableRootName);
             if (TRUE === $useRawKeys) {
                 return ObjectAccess::getPropertyPath($templateVariableRoot, implode('.', $segments));
             }
             try {
                 $value = $templateVariableRoot;
                 foreach ($segments as $segment) {
                     if (TRUE === ctype_digit($segment)) {
                         $segment = intval($segment);
                         $index = 0;
                         // Note: this loop approach is not a stupid solution. If you doubt this,
                         // attempt to feth a number at a numeric index from ObjectStorage ;)
                         foreach ($value as $possibleValue) {
                             if ($index === $segment) {
                                 $value = $possibleValue;
                                 break;
                             }
                             ++$index;
                         }
                         continue;
                     }
                     $value = ObjectAccess::getProperty($value, $segment);
                 }
                 return $value;
             } catch (\Exception $e) {
                 return NULL;
             }
         }
     }
     return NULL;
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:47,代码来源:GetViewHelper.php

示例11: getOption

 /**
  * Build a option array.
  *
  * @param string $key
  * @param string $value
  * @return array an associative array of an option, key will be the value of the option tag
  */
 protected function getOption($key, $value)
 {
     $option = array();
     if (is_object($value) || is_array($value)) {
         if ($this->hasArgument('optionValueField')) {
             $key = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($value, $this->arguments['optionValueField']);
             if (is_object($key)) {
                 if (method_exists($key, '__toString')) {
                     $key = (string) $key;
                 } else {
                     throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Identifying value for object of class "' . get_class($value) . '" was an object.', 1247827428);
                 }
             }
             // @todo use $this->persistenceManager->isNewObject() once it is implemented
         } elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
             $key = $this->persistenceManager->getIdentifierByObject($value);
         } elseif (method_exists($value, '__toString')) {
             $key = (string) $value;
         } else {
             throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('No identifying value for object of class "' . get_class($value) . '" found.', 1247826696);
         }
         if ($this->hasArgument('optionLabelField')) {
             $value = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($value, $this->arguments['optionLabelField']);
             if (is_object($value)) {
                 if (method_exists($value, '__toString')) {
                     $value = (string) $value;
                 } else {
                     throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Label value for object of class "' . get_class($value) . '" was an object without a __toString() method.', 1247827553);
                 }
             }
         } elseif (method_exists($value, '__toString')) {
             $value = (string) $value;
             // @todo use $this->persistenceManager->isNewObject() once it is implemented
         } elseif ($this->persistenceManager->getIdentifierByObject($value) !== null) {
             $value = $this->persistenceManager->getIdentifierByObject($value);
         }
     }
     $option[$key] = $value;
     return $option;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:47,代码来源:SelectViewHelper.php

示例12: render

 /**
  * @return string
  */
 public function render()
 {
     $value = NULL;
     if ($this->arguments['object']) {
         if ($this->arguments['attribute']) {
             $getter = 'get' . ucfirst($this->arguments['attribute']);
         } else {
             $getter = $this->arguments['getter'];
         }
         if ($getter && is_object($this->arguments['object']) && method_exists($this->arguments['object'], $getter)) {
             $value = call_user_func(array($this->arguments['object'], $getter));
         } else {
             $value = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($this->arguments['object'], $this->arguments['attribute']);
         }
     }
     if ($this->arguments['as']) {
         $variableNameArr = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('.', $this->arguments['as'], TRUE, 2);
         $variableName = $variableNameArr[0];
         $attributePath = $variableNameArr[1];
         if ($this->templateVariableContainer->exists($variableName)) {
             $oldValue = $this->templateVariableContainer->get($variableName);
             $this->templateVariableContainer->remove($variableName);
         }
         if ($attributePath) {
             if ($oldValue && is_array($oldValue)) {
                 $templateValue = $oldValue;
                 $templateValue[$attributePath] = $value;
             } else {
                 $templateValue = array($attributePath => $value);
             }
         } else {
             $templateValue = $value;
         }
         $this->templateVariableContainer->add($variableName, $templateValue);
         return '';
     } else {
         return $value;
     }
 }
开发者ID:seitenarchitekt,项目名称:extbase_hijax,代码行数:42,代码来源:ObjectAccessViewHelper.php

示例13: groupElements

 /**
  * Groups the given array by the specified groupBy property.
  *
  * @param array $elements The array / traversable object to be grouped
  * @param string $groupBy Group by this property
  * @return array The grouped array in the form array('keys' => array('key1' => [key1value], 'key2' => [key2value], ...), 'values' => array('key1' => array([key1value] => [element1]), ...), ...)
  * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception
  */
 protected function groupElements(array $elements, $groupBy)
 {
     $groups = array('keys' => array(), 'values' => array());
     foreach ($elements as $key => $value) {
         if (is_array($value)) {
             $currentGroupIndex = isset($value[$groupBy]) ? $value[$groupBy] : NULL;
         } elseif (is_object($value)) {
             $currentGroupIndex = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath($value, $groupBy);
         } else {
             throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('GroupedForViewHelper only supports multi-dimensional arrays and objects', 1253120365);
         }
         $currentGroupKeyValue = $currentGroupIndex;
         if (is_object($currentGroupIndex)) {
             if ($currentGroupIndex instanceof \TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
                 $currentGroupIndex = $currentGroupIndex->_loadRealInstance();
             }
             $currentGroupIndex = spl_object_hash($currentGroupIndex);
         }
         $groups['keys'][$currentGroupIndex] = $currentGroupKeyValue;
         $groups['values'][$currentGroupIndex][$key] = $value;
     }
     return $groups;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:31,代码来源:GroupedForViewHelper.php

示例14: recursivelyExtractKey

 /**
  * Recursively extract the key
  *
  * @param \Traversable $iterator
  * @param string $key
  * @return string
  * @throws \Exception
  */
 public function recursivelyExtractKey($iterator, $key)
 {
     $content = array();
     foreach ($iterator as $k => $v) {
         // Lets see if we find something directly:
         $result = ObjectAccess::getPropertyPath($v, $key);
         if (NULL !== $result) {
             $content[] = $result;
         } elseif (TRUE === is_array($v) || TRUE === $v instanceof \Traversable) {
             $content[] = $this->recursivelyExtractKey($v, $key);
         }
     }
     $content = $this->flattenArray($content);
     return $content;
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:23,代码来源:ExtractViewHelper.php

示例15: getVariable

 /**
  * @param string $name
  * @return mixed
  */
 public function getVariable($name)
 {
     return ObjectAccess::getPropertyPath($this->variables, $name);
 }
开发者ID:fluidtypo3,项目名称:flux,代码行数:8,代码来源:AbstractFormComponent.php


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