Neos\Flow\Property\PropertyMappingConfiguration::getConfigurationFor PHP Метод

getConfigurationFor() публичный Метод

Returns the sub-configuration for the passed $propertyName. Must ALWAYS return a valid configuration object!
public getConfigurationFor ( string $propertyName ) : Neos\Flow\Property\PropertyMappingConfigurationInterface
$propertyName string
Результат Neos\Flow\Property\PropertyMappingConfigurationInterface the property mapping configuration for the given $propertyName.
    public function getConfigurationFor($propertyName)
    {
        if (isset($this->subConfigurationForProperty[$propertyName])) {
            return $this->subConfigurationForProperty[$propertyName];
        } elseif (isset($this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER])) {
            return $this->subConfigurationForProperty[self::PROPERTY_PATH_PLACEHOLDER];
        }
        return new PropertyMappingConfiguration();
    }

Usage Example

 /**
  * @test
  */
 public function forPropertyWithAsteriskAllowsArbitraryPropertyNamesWithGetConfigurationFor()
 {
     // using stdClass so that class_parents() in getTypeConvertersWithParentClasses() is happy
     $this->propertyMappingConfiguration->forProperty('items.*')->setTypeConverterOptions('stdClass', ['k1' => 'v1']);
     $configuration = $this->propertyMappingConfiguration->getConfigurationFor('items')->getConfigurationFor('6');
     $this->assertSame('v1', $configuration->getConfigurationValue(\stdClass::class, 'k1'));
 }