コード例 #1
0
 public function testIsAssociationOwningSideEntityWithGroupName()
 {
     $config1 = new Config(new EntityConfigId('grouping', 'Test\\Entity1'));
     $config1->set('groups', ['some_group', 'another_group']);
     $config2 = new Config(new EntityConfigId('grouping', 'Test\\Entity2'));
     $config2->set('groups', ['another_group']);
     $config3 = new Config(new EntityConfigId('grouping', 'Test\\Entity3'));
     $configs = [$config1, $config2, $config3];
     $configProvider = $this->getConfigProviderMock();
     $this->configManager->expects($this->once())->method('getProvider')->with('grouping')->will($this->returnValue($configProvider));
     $configProvider->expects($this->once())->method('getConfigs')->will($this->returnValue($configs));
     $this->assertTrue($this->typeHelper->isAssociationOwningSideEntity('Test\\Entity1', 'some_group'));
     $this->assertFalse($this->typeHelper->isAssociationOwningSideEntity('Test\\Entity', 'some_group'));
     $this->assertFalse($this->typeHelper->isAssociationOwningSideEntity('Test\\Entity2', 'some_group'));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function isReadOnly($options)
 {
     /** @var EntityConfigId $configId */
     $configId = $options['config_id'];
     $className = $configId->getClassName();
     if (!empty($className)) {
         if ($this->typeHelper->isAssociationOwningSideEntity($className, $options['association_class'])) {
             return true;
         }
         if ($this->typeHelper->isDictionary($className)) {
             return true;
         }
     }
     return parent::isReadOnly($options);
 }