class ModuleInstallConfigTestSubscriber

Test subscriber for configuration CRUD event.

Hierarchy

  • class \Drupal\module_installer_config_subscriber\EventSubscriber\ModuleInstallConfigTestSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of ModuleInstallConfigTestSubscriber

File

core/modules/system/tests/modules/module_installer_config_subscriber/src/EventSubscriber/ModuleInstallConfigTestSubscriber.php, line 18

Namespace

Drupal\module_installer_config_subscriber\EventSubscriber
View source
class ModuleInstallConfigTestSubscriber implements EventSubscriberInterface {
    public function __construct(EntityTypeManagerInterface $entityTypeManager, Connection $connection, KeyValueFactoryInterface $keyValue) {
    }
    
    /**
     * Reacts to a test simple configuration object being installed.
     *
     * @param \Drupal\Core\Config\ConfigCrudEvent $event
     *   The ConfigCrudEvent to process.
     */
    public function onSave(ConfigCrudEvent $event) : void {
        if ($event->getConfig()
            ->getName() !== 'module_installer_config_subscriber.settings' || !($definition = $this->entityTypeManager
            ->getDefinition('node', FALSE))) {
            return;
        }
        $table = $definition->get('data_table');
        if (!$this->connection
            ->schema()
            ->tableExists($table)) {
            $this->keyValue
                ->get('module_installer_config_subscriber')
                ->set('node_tables_missing', TRUE);
        }
    }
    
    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents() : array {
        $events[ConfigEvents::SAVE][] = [
            'onSave',
        ];
        return $events;
    }

}

Members

Title Sort descending Modifiers Object type Summary
ModuleInstallConfigTestSubscriber::getSubscribedEvents public static function
ModuleInstallConfigTestSubscriber::onSave public function Reacts to a test simple configuration object being installed.
ModuleInstallConfigTestSubscriber::__construct public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.