forProperty() 공개 메소드

...)
public forProperty ( string $propertyPath ) : PropertyMappingConfiguration
$propertyPath string
리턴 PropertyMappingConfiguration (or a subclass thereof)
 /**
  * @test
  */
 public function getTypeOfChildPropertyImmediatelyReturnsConfiguredTargetTypeIfSetSo()
 {
     $propertyName = 'somePropertyName';
     $expectedTargetType = 'someExpectedTargetType';
     $configuration = new PropertyMappingConfiguration();
     $configuration->forProperty($propertyName)->setTypeConverterOption(ObjectConverter::class, ObjectConverter::CONFIGURATION_TARGET_TYPE, $expectedTargetType);
     $actual = $this->converter->getTypeOfChildProperty('irrelevant', $propertyName, $configuration);
     $this->assertEquals($expectedTargetType, $actual);
 }
 /**
  * Modify the passed $propertyMappingConfiguration according to the $propertyConfiguration which
  * has been generated by Fluid. In detail, if the $propertyConfiguration contains
  * an __identity field, we allow modification of objects; else we allow creation.
  *
  * All other properties are specified as allowed properties.
  *
  * @param array $propertyConfiguration
  * @param PropertyMappingConfiguration $propertyMappingConfiguration
  * @return void
  */
 protected function modifyPropertyMappingConfiguration($propertyConfiguration, PropertyMappingConfiguration $propertyMappingConfiguration)
 {
     if (!is_array($propertyConfiguration)) {
         return;
     }
     if (isset($propertyConfiguration['__identity'])) {
         $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED, true);
         unset($propertyConfiguration['__identity']);
     } else {
         $propertyMappingConfiguration->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true);
     }
     foreach ($propertyConfiguration as $innerKey => $innerValue) {
         if (is_array($innerValue)) {
             $this->modifyPropertyMappingConfiguration($innerValue, $propertyMappingConfiguration->forProperty($innerKey));
         }
         $propertyMappingConfiguration->allowProperties($innerKey);
     }
 }
 /**
  * @test
  */
 public function forPropertyWithAsteriskAllowsArbitraryPropertyNamesWithShouldMap()
 {
     $this->propertyMappingConfiguration->forProperty('items.*')->setTypeConverterOptions('stdClass', ['k1' => 'v1']);
     $configuration = $this->propertyMappingConfiguration->forProperty('items');
     $this->assertTrue($configuration->shouldMap(6));
 }