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


PHP ObjectAccess::getGettableProperties方法代码示例

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


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

示例1: convertFrom

 /**
  * Actually convert from $source to $targetType, taking into account the fully
  * built $convertedChildProperties and $configuration.
  *
  * The return value can be one of three types:
  * - an arbitrary object, or a simple type (which has been created while mapping).
  *   This is the normal case.
  * - NULL, indicating that this object should *not* be mapped (i.e. a "File Upload" Converter could return NULL if no file has been uploaded, and a silent failure should occur.
  * - An instance of \TYPO3\Flow\Error\Error -- This will be a user-visible error message later on.
  * Furthermore, it should throw an Exception if an unexpected failure (like a security error) occurred or a configuration issue happened.
  *
  * @param mixed $source
  * @param string $targetType
  * @param array $convertedChildProperties
  * @param PropertyMappingConfigurationInterface $configuration
  * @return mixed|\TYPO3\Flow\Error\Error the target type, or an error object if a user-error occurred
  * @throws \TYPO3\Flow\Property\Exception\TypeConverterException thrown in case a developer error occurred
  * @api
  */
 public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
 {
     $properties = ObjectAccess::getGettableProperties($source);
     if ($source instanceof \Doctrine\ORM\Proxy\Proxy) {
         $className = get_parent_class($source);
     } else {
         $className = get_class($source);
     }
     $properties = array_merge($properties, $convertedChildProperties);
     if ($source instanceof \TYPO3\Flow\Persistence\Aspect\PersistenceMagicInterface) {
         $properties['__identity'] = $this->persistenceManager->getIdentifierByObject($source);
     }
     $properties['__type'] = $className;
     return $properties;
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:34,代码来源:ArrayFromObjectConverter.php

示例2: convertFrom

 /**
  * Convert an object from \TYPO3\Media\Domain\Model\ImageInterface to a json representation
  *
  * @param ImageInterface $source
  * @param string $targetType must be 'string'
  * @param array $convertedChildProperties
  * @param \TYPO3\Flow\Property\PropertyMappingConfigurationInterface $configuration
  * @return string|\TYPO3\Flow\Validation\Error The converted Image, a Validation Error or NULL
  */
 public function convertFrom($source, $targetType, array $convertedChildProperties = array(), \TYPO3\Flow\Property\PropertyMappingConfigurationInterface $configuration = NULL)
 {
     $data = array('__identity' => $this->persistenceManager->getIdentifierByObject($source), '__type' => TypeHandling::getTypeForValue($source));
     if ($source instanceof \TYPO3\Media\Domain\Model\ImageVariant) {
         $data['originalAsset'] = ['__identity' => $this->persistenceManager->getIdentifierByObject($source->getOriginalAsset())];
         $adjustments = array();
         foreach ($source->getAdjustments() as $adjustment) {
             $index = TypeHandling::getTypeForValue($adjustment);
             $adjustments[$index] = array();
             foreach (\TYPO3\Flow\Reflection\ObjectAccess::getGettableProperties($adjustment) as $propertyName => $propertyValue) {
                 $adjustments[$index][$propertyName] = $propertyValue;
             }
         }
         $data['adjustments'] = $adjustments;
     }
     return $data;
 }
开发者ID:netlogix,项目名称:media,代码行数:26,代码来源:ImageInterfaceArrayPresenter.php

示例3: getProperties

 /**
  * Returns all properties of this node.
  *
  * If the node has a content object attached, the properties will be fetched
  * there.
  *
  * @param boolean $returnNodesAsIdentifiers If enabled, references to nodes are returned as node identifiers instead of NodeData objects
  * @param \TYPO3\TYPO3CR\Domain\Service\Context $context An optional Context if $returnNodesAsIdentifiers === TRUE
  * @return array Property values, indexed by their name
  */
 public function getProperties($returnNodesAsIdentifiers = FALSE, \TYPO3\TYPO3CR\Domain\Service\Context $context = NULL)
 {
     if (is_object($this->contentObjectProxy)) {
         return ObjectAccess::getGettableProperties($this->contentObjectProxy->getObject());
     }
     $properties = array();
     foreach (array_keys($this->properties) as $propertyName) {
         $properties[$propertyName] = $this->getProperty($propertyName, $returnNodesAsIdentifiers, $context);
     }
     return $properties;
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:21,代码来源:AbstractNodeData.php

示例4: getProperties

 /**
  * Returns all properties of this node.
  *
  * If the node has a content object attached, the properties will be fetched
  * there.
  *
  * @return array Property values, indexed by their name
  */
 public function getProperties()
 {
     if (is_object($this->contentObjectProxy)) {
         return ObjectAccess::getGettableProperties($this->contentObjectProxy->getObject());
     }
     $properties = array();
     foreach (array_keys($this->properties) as $propertyName) {
         $properties[$propertyName] = $this->getProperty($propertyName);
     }
     return $properties;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:19,代码来源:AbstractNodeData.php

示例5: getGettablePropertiesReturnsPropertiesOfStdClass

 /**
  * @test
  */
 public function getGettablePropertiesReturnsPropertiesOfStdClass()
 {
     $stdClassObject = new \stdClass();
     $stdClassObject->property = 'string1';
     $stdClassObject->property2 = NULL;
     $stdClassObject->publicProperty2 = 42;
     $expectedProperties = array('property' => 'string1', 'property2' => NULL, 'publicProperty2' => 42);
     $actualProperties = ObjectAccess::getGettableProperties($stdClassObject);
     $this->assertEquals($expectedProperties, $actualProperties, 'expectedProperties did not return the right values for the properties.');
 }
开发者ID:animaltool,项目名称:webinterface,代码行数:13,代码来源:ObjectAccessTest.php

示例6: getGettablePropertiesHandlesDoctrineProxy

 /**
  * @test
  */
 public function getGettablePropertiesHandlesDoctrineProxy()
 {
     $proxyObject = new \TYPO3\Flow\Tests\Reflection\Fixture\Model\EntityWithDoctrineProxy();
     $expectedProperties = array();
     $actualProperties = ObjectAccess::getGettableProperties($proxyObject);
     $this->assertEquals($expectedProperties, $actualProperties, 'expectedProperties did not return the right values for the properties.');
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:10,代码来源:ObjectAccessTest.php

示例7: serialize

 /**
  * @param Message $message
  * @return array
  */
 public function serialize(Message $message)
 {
     $messageType = new ObjectName($message);
     $data = ObjectAccess::getGettableProperties($message);
     return ['messageType' => $messageType->getName(), 'payload' => $data];
 }
开发者ID:flow2lab,项目名称:eventsourcing,代码行数:10,代码来源:ArraySerializer.php

示例8: applyAdjustment

 /**
  * Apply the given adjustment to the image variant.
  * If an adjustment of the given type already exists, the existing one will be overridden by the new one.
  *
  * @param ImageAdjustmentInterface $adjustment
  * @return void
  */
 protected function applyAdjustment(ImageAdjustmentInterface $adjustment)
 {
     $existingAdjustmentFound = false;
     $newAdjustmentClassName = TypeHandling::getTypeForValue($adjustment);
     foreach ($this->adjustments as $existingAdjustment) {
         if (TypeHandling::getTypeForValue($existingAdjustment) === $newAdjustmentClassName) {
             foreach (ObjectAccess::getGettableProperties($adjustment) as $propertyName => $propertyValue) {
                 ObjectAccess::setProperty($existingAdjustment, $propertyName, $propertyValue);
             }
             $existingAdjustmentFound = true;
         }
     }
     if (!$existingAdjustmentFound) {
         $this->adjustments->add($adjustment);
         $adjustment->setImageVariant($this);
         $this->adjustments = $this->adjustments->matching(new \Doctrine\Common\Collections\Criteria(null, array('position' => 'ASC')));
     }
     $this->lastModified = new \DateTime();
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:26,代码来源:ImageVariant.php

示例9: serialize

 /**
  * @param Message $message
  * @return array
  */
 public function serialize(Message $message)
 {
     $type = str_replace('\\', '.', get_class($message));
     $data = ObjectAccess::getGettableProperties($message);
     return ['messageType' => $type, 'payload' => $data];
 }
开发者ID:etg24,项目名称:eventsourcing,代码行数:10,代码来源:ArraySerializer.php


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