Пример #1
0
 /**
  * @param FieldMetadata $fieldMetadata
  */
 protected function applyFieldMetadataConfig(FieldMetadata $fieldMetadata)
 {
     $this->entityConfigHelper->prepareFieldMetadataPropertyPath($fieldMetadata);
     $mergeConfig = $this->entityConfigHelper->getConfigByFieldMetadata(self::CONFIG_MERGE_SCOPE, $fieldMetadata);
     if ($mergeConfig) {
         $mergeOptions = $this->filterInverseOptions($mergeConfig->all(), $fieldMetadata->isDefinedBySourceEntity());
         $fieldMetadata->merge($mergeOptions);
     }
 }
Пример #2
0
 public function testGetConfigByFieldMetadataForNotExtendField()
 {
     $scope = 'merge';
     $className = 'Namespace\\Entity';
     $fieldName = 'test';
     $fieldMetadata = $this->createFieldMetadata();
     $fieldMetadata->expects($this->once())->method('getSourceClassName')->will($this->returnValue($className));
     $fieldMetadata->expects($this->once())->method('getSourceFieldName')->will($this->returnValue($fieldName));
     $mergeConfigProvider = $this->createConfigProvider();
     $this->configManager->expects($this->once())->method('getProvider')->with($scope)->will($this->returnValue($mergeConfigProvider));
     $mergeConfigProvider->expects($this->once())->method('hasConfig')->with($className, $fieldName)->will($this->returnValue(true));
     $mergeConfig = $this->createConfig();
     $mergeConfigProvider->expects($this->once())->method('getConfig')->with($className, $fieldName)->will($this->returnValue($mergeConfig));
     $this->assertSame($mergeConfig, $this->helper->getConfigByFieldMetadata($scope, $fieldMetadata));
 }