Exemplo n.º 1
0
 /**
  * Checks if the form type should be read-only or not
  *
  * @param array $options
  *
  * @return bool
  */
 protected function isReadOnly($options)
 {
     /** @var ConfigIdInterface $configId */
     $configId = $options['config_id'];
     $className = $configId->getClassName();
     if (empty($className)) {
         return false;
     }
     return $this->typeHelper->isImmutable($configId->getScope(), $className, $this->typeHelper->getFieldName($configId));
 }
Exemplo n.º 2
0
 /**
  * @dataProvider isImmutableProvider
  */
 public function testIsImmutable($value, $expected, $fieldName = null, $constraintName = null)
 {
     $scope = 'test_scope';
     $className = 'Test\\Entity';
     $config = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Config')->disableOriginalConstructor()->getMock();
     $config->expects($this->once())->method('get')->with('immutable')->will($this->returnValue($value));
     $configProvider = $this->getConfigProviderMock();
     $this->configManager->expects($this->once())->method('getProvider')->with($scope)->will($this->returnValue($configProvider));
     $configProvider->expects($this->once())->method('hasConfig')->with($className, $fieldName)->will($this->returnValue(true));
     $configProvider->expects($this->once())->method('getConfig')->with($className, $fieldName)->will($this->returnValue($config));
     $this->assertSame($expected, $this->typeHelper->isImmutable($scope, $className, $fieldName, $constraintName));
 }
Exemplo n.º 3
0
 /**
  * @param ConfigManager       $configManager
  * @param EntityClassResolver $entityClassResolver
  */
 public function __construct(ConfigManager $configManager, EntityClassResolver $entityClassResolver)
 {
     parent::__construct($configManager);
     $this->entityClassResolver = $entityClassResolver;
 }