コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function isReadOnly($options)
 {
     /** @var EntityConfigId $configId */
     $configId = $options['config_id'];
     $className = $configId->getClassName();
     if (!empty($className) && $this->typeHelper->isDictionary($className) && !$this->typeHelper->isSupportActivityEnabled($className)) {
         return true;
     }
     return parent::isReadOnly($options);
 }
コード例 #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);
 }
コード例 #3
0
 public function testGetOwningSideEntities()
 {
     $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->exactly(2))->method('getProvider')->with('grouping')->will($this->returnValue($configProvider));
     $configProvider->expects($this->exactly(2))->method('getConfigs')->will($this->returnValue($configs));
     $this->assertEquals(['Test\\Entity1'], $this->typeHelper->getOwningSideEntities('some_group'));
     // one more call to check caching
     $this->assertEquals(['Test\\Entity1'], $this->typeHelper->getOwningSideEntities('some_group'));
     // call with another group to check a caching has no collisions
     $this->assertEquals(['Test\\Entity1', 'Test\\Entity2'], $this->typeHelper->getOwningSideEntities('another_group'));
 }