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


PHP ObjectAccess::getSettablePropertyNames方法代码示例

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


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

示例1: supportsChainingInAllSettersWithFakeNullArgument

 /**
  * @test
  */
 public function supportsChainingInAllSettersWithFakeNullArgument()
 {
     $asset = Asset::getInstance();
     $settableProperties = ObjectAccess::getSettablePropertyNames($asset);
     foreach ($settableProperties as $propertyName) {
         $setter = 'set' . ucfirst($propertyName);
         $asset = $asset->{$setter}(NULL);
         $this->assertInstanceOf('FluidTYPO3\\Vhs\\Asset', $asset, 'The ' . $setter . ' method does not support chaining');
     }
 }
开发者ID:samuweiss,项目名称:TYPO3-Site,代码行数:13,代码来源:AssetTest.php

示例2: getSettablePropertyNamesReturnsPropertyNamesOfStdClass

 /**
  * @test
  */
 public function getSettablePropertyNamesReturnsPropertyNamesOfStdClass()
 {
     $stdClassObject = new \stdClass();
     $stdClassObject->property = 'string1';
     $stdClassObject->property2 = NULL;
     $settablePropertyNames = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getSettablePropertyNames($stdClassObject);
     $expectedPropertyNames = array('property', 'property2');
     $this->assertEquals($expectedPropertyNames, $settablePropertyNames, 'getSettablePropertyNames returns not all settable properties.');
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:12,代码来源:ObjectAccessTest.php

示例3: cloneNewsAction

 /**
  * action clone news
  *
  * @param \int $uid	 
  * @return void
  */
 public function cloneNewsAction($uid = 0)
 {
     if ($uid > 0) {
         $defaultStorageFields = array("categories", "contentElements", "relatedFiles", "relatedLinks", "media", "falMedia", "falRelatedFiles");
         $testedStorageFields = array("categories");
         $storageClasses = array("TYPO3\\CMS\\Extbase\\Persistence\\Generic\\LazyObjectStorage");
         $original = $this->newsRepository->findByUid($uid, FALSE);
         $clone = $this->objectManager->create('Tx_MooxNews_Domain_Model_News');
         // $product = source object
         $properties = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getSettablePropertyNames($original);
         foreach ($properties as $name) {
             $value = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($original, $name);
             if (!in_array($name, $defaultStorageFields) && (!is_object($value) || is_object($value) && !in_array(get_class($value), $storageClasses))) {
                 \TYPO3\CMS\Extbase\Reflection\ObjectAccess::setProperty($clone, $name, $value);
             }
         }
         foreach ($properties as $name) {
             $value = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($original, $name);
             if (in_array($name, $defaultStorageFields) && in_array($name, $testedStorageFields) || !in_array($name, $defaultStorageFields) && is_object($value) && in_array(get_class($value), $storageClasses)) {
                 $getCall = "get" . ucfirst($name);
                 $setCall = "get" . ucfirst($name);
                 if (method_exists($original, $getCall)) {
                     $objects = $original->{$getCall}();
                     if (method_exists($clone->{$getCall}(), "attach")) {
                         if (count($objects)) {
                             foreach ($objects as $object) {
                                 if (\TYPO3\CMS\Extbase\Reflection\ObjectAccess::isPropertySettable($object, "uid")) {
                                     //$object->setUid(NULL);
                                 }
                                 $clone->{$getCall}()->attach($object);
                             }
                         }
                     } elseif (method_exists($clone, $setCall)) {
                         $clone->{$setCall}($objects);
                     }
                 }
             }
         }
         $clone->setTitle($original->getTitle() . " [Kopie]");
         $clone->setHidden(1);
         $this->newsRepository->add($clone);
         $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\PersistenceManagerInterface')->persistAll();
         $this->flashMessageContainer->add('', 'Eintrag wurde dupliziert', \TYPO3\CMS\Core\Messaging\FlashMessage::OK);
     }
     $this->redirect("index");
 }
开发者ID:preinboth,项目名称:moox_news,代码行数:52,代码来源:AdministrationController.php


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