/** * @param EntityConfigEvent $event */ public function updateEntity(EntityConfigEvent $event) { $className = $event->getClassName(); $parentClassName = get_parent_class($className); if (!$parentClassName) { return; } if (ExtendHelper::isExtendEntityProxy($parentClassName)) { // When application is installed parent class will be replaced (via class_alias) $extendClass = $parentClassName; } else { // During install parent class is not replaced (via class_alias) $shortClassName = ExtendHelper::getShortClassName($className); if (ExtendHelper::getShortClassName($parentClassName) !== 'Extend' . $shortClassName) { return; } $extendClass = ExtendHelper::getExtendEntityProxyClassName($parentClassName); } $configManager = $event->getConfigManager(); $config = $configManager->getProvider('extend')->getConfig($className); $hasChanges = false; if (!$config->is('is_extend')) { $config->set('is_extend', true); $hasChanges = true; } if (!$config->is('extend_class', $extendClass)) { $config->set('extend_class', $extendClass); $hasChanges = true; } if ($hasChanges) { $configManager->persist($config); } }