/**
  * @param NewEntityConfigModelEvent $event
  */
 public function newEntityConfig(NewEntityConfigModelEvent $event)
 {
     // clear cache when new entity added to configurator
     // in case if default value for some fields will equal true
     $cp = $event->getConfigManager()->getProvider('email');
     $fieldConfigs = $cp->filter(function (ConfigInterface $config) {
         return $config->is('available_in_template');
     }, $event->getClassName());
     if (count($fieldConfigs)) {
         $this->cache->delete($this->cacheKey);
     }
 }
 public function testEvent()
 {
     $event = new NewEntityConfigModelEvent(new EntityConfigModel('Test\\Class'), $this->configManager);
     $this->assertEquals('Test\\Class', $event->getClassName());
     $this->assertEquals($this->configManager, $event->getConfigManager());
 }
 /**
  * @param NewEntityConfigModelEvent $event
  */
 public function newEntityConfig(NewEntityConfigModelEvent $event)
 {
     $cp = $event->getConfigManager()->getProvider('security');
     $config = $cp->getConfig($event->getClassName());
     $config->set('type', EntitySecurityMetadataProvider::ACL_SECURITY_TYPE);
 }
 /**
  * @param NewEntityConfigModelEvent $event
  */
 public function newEntity(NewEntityConfigModelEvent $event)
 {
     $originalClassName = $event->getClassName();
     $originalParentClassName = get_parent_class($originalClassName);
     $parentClassArray = explode('\\', $originalParentClassName);
     $classArray = explode('\\', $originalClassName);
     $parentClassName = array_pop($parentClassArray);
     $className = array_pop($classArray);
     if ($parentClassName == 'Extend' . $className) {
         $config = $event->getConfigManager()->getProvider('extend')->getConfig($event->getClassName());
         $config->set('is_extend', true);
         $config->set('extend_class', ExtendConfigDumper::ENTITY . $parentClassName);
         $event->getConfigManager()->persist($config);
     }
 }