/**
  * @param NewFieldConfigModelEvent $event
  */
 public function newField(NewFieldConfigModelEvent $event)
 {
     $configProvider = $event->getConfigManager()->getProvider('entity');
     $config = $configProvider->getConfig($event->getClassName(), $event->getFieldName());
     if (!$config->is('label')) {
         $config->set('label', $event->getFieldName());
     }
 }
 public function testEvent()
 {
     $entityConfigModel = new EntityConfigModel('Test\\Class');
     $fieldConfigModel = new FieldConfigModel('testField', 'string');
     $fieldConfigModel->setEntity($entityConfigModel);
     $event = new NewFieldConfigModelEvent($fieldConfigModel, $this->configManager);
     $this->assertEquals('Test\\Class', $event->getClassName());
     $this->assertEquals('testField', $event->getFieldName());
     $this->assertEquals('string', $event->getFieldType());
     $this->assertEquals($this->configManager, $event->getConfigManager());
 }
 /**
  * @param NewFieldConfigModelEvent $event
  */
 public function newField(NewFieldConfigModelEvent $event)
 {
     /** @var ConfigProvider $configProvider */
     $configProvider = $event->getConfigManager()->getProvider('extend');
     $entityConfig = $configProvider->getConfig($event->getClassName());
     if ($entityConfig->is('upgradeable', false)) {
         $entityConfig->set('upgradeable', true);
         $configProvider->persist($entityConfig);
     }
 }