Ensure existing config and routing for the shop bundle.

@param Event $event Event instance
@throws \RuntimeException If an error occured
325443
public static function updateConfig( Event $event )
	{
		$event->getIO()->write( 'Ensure existing config and routing for the shop bundle' );

		$options = self::getOptions( $event );

		if( isset( $options['symfony-app-dir'] ) )
		{
			self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' );
			self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' );
		}
	}
1128349
public static function importRoutes(Event $event) {
        $options = self::getOptions($event);
        $appDir = $options['symfony-app-dir'];
        $webDir = $options['symfony-web-dir'];

        if (!is_dir($webDir)) {
            echo 'The symfony-web-dir (' . $webDir . ') specified in composer.json was not found in ' . getcwd() . ', can not install assets.' . PHP_EOL;

            return;
        }

        static::executeCommand($event, $appDir, 'wucdbm_menu_builder:import_routes');
    }
1273941
public function beforeFilter($event)
    {
        $this->Controller->authUser = $this->Controller->Auth->user();

        // beforeFilter-event
        $_event = new Event('Component.Manager.beforeFilter', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        // beforeFilter-event for prefixes
        if ($this->isPrefix()) {
            $this->_runCallback("beforeFilter", $event);

            // beforeFilter-event with Prefix
            $this->_runEvent("beforeFilter");
        }

        $this->__loadHelpers();
    }
1080037
public function beforeRender(Event $event)
    {
        if ($this->_controller()->getName() === 'Error') {
            return;
        }

        if (!empty($event->getSubject()->entity)) {
            $this->_entity = $event->getSubject()->entity;
        }

        if ($this->associations === null) {
            $this->associations = $this->_associations(array_keys($this->_getRelatedModels()));
        }

        $this->ensureConfig();

        $this->beforeRenderFormType();
        $this->beforeRenderIndexType();
        $this->beforeRenderSiteTitle();
        $this->beforeRenderUtilityNavigation();
        $this->beforeRenderSidebarNavigation();

        $controller = $this->_controller();
        $controller->set('actionConfig', $this->_action()->getConfig());
        $controller->set('title', $this->_getPageTitle());
        $controller->set('breadcrumbs', $this->_getBreadcrumbs());

        $associations = $this->associations;
        $controller->set(compact('associations'));

        $fields = $this->_scaffoldFields($associations);
        $controller->set('fields', $fields);
        $controller->set('formTabGroups', $this->_getFormTabGroups($fields));

        $controller->set('blacklist', $this->_blacklist());
        $controller->set('actions', $this->_getControllerActions());
        $controller->set('bulkActions', $this->_getBulkActions());
        $controller->set('viewblocks', $this->_getViewBlocks());
        $controller->set('actionGroups', $this->_getActionGroups());
        $controller->set($this->_getPageVariables());
    }
122841
public function beforeFilter(Event $event)
    {
        $this->controller = $event->getSubject();
        $this->request = $this->controller->request;
        $this->action = $this->request->getParam('action');
        $this->Filters = TableRegistry::get($this->getConfig('filterTable'));

        $this->_setupSort();
        $this->_setupFilters();
        $this->_setupPagination();
    }
618460
public function afterStore(Event $event) {
		$this->pathBuilder($event->getSubject()->pathBuilder());
		$this->subject = $event->getSubject();

		$this->autoProcessImageVersions($event->getData('entity'), 'create');
	}
745720
public function startup(Event $Event) {
		$Controller = $Event->subject();
		$this->Controller = $Controller;
		if (!empty($this->_config['actions'])) {
			if (in_array($this->Controlle->action, $this->_config['actions'])) {
				if ($this->_config['checkHash'] === true) {
					$this->checkHash();
				}
				$this->unpackParams();
			}
		}
	}
1009156
public function injectSearch(Event $event)
    {
        if (!in_array($event->getName(), $this->getConfig('enabled'))) {
            return;
        }

        $repository = $this->_table();
        if ($repository instanceof Table && !$repository->behaviors()->has('Search')) {
            throw new RuntimeException(sprintf(
                'Missing Search.Search behavior on %s',
                get_class($repository)
            ));
        }

        if ($repository instanceof Table && $repository->behaviors()->hasMethod('filterParams')) {
            $filterParams = $repository->filterParams($this->_request()->getQuery());
        } else {
            $filterParams = ['search' => $this->_request()->getQuery()];
        }

        $filterParams['collection'] = $this->getConfig('collection');
        $event->getSubject()->query->find('search', $filterParams);
    }
698904
final protected function apply(DomainEvent $event) : void
    {
        $this->handleEventInAggregate($event);
        parent::raise($event);
    }
336730
public function detach($event)
    {
        if ($this->has($event)) {
            unset($this->listeners[$event]);
        } else {
            throw new RuntimeException(sprintf(
                'Cannot detach non-existing event "%s"', $event
            ));
        }
    }
1127134
public function onAfterRender(Event $event)
    {
        $config = Ioc::getConfig();

        $array = $config->flatten();

        $keys = array_map(function ($value) {
            return StringHelper::quote($value) . ' instanceof mixed';
        }, array_keys($array));

        $data = str_replace('{config}', implode(",\n", $keys), $this->tmpl);

        File::write(WINDWALKER_TEMP . '/ide/.phpstorm.meta.php', $data);

        // For php toolbox
        $tmpl = <<<TMPL
{
    "registrar": [
        {
            "language": "php",
            "provider": "config",
            "signature": [
                "Windwalker\\\\Core\\\\Config\\\\Config:get",
                "Windwalker\\\\Core\\\\Config\\\\Config:set",
                "Windwalker\\\\Application\\\\AbstractApplication:get",
                "Windwalker\\\\Application\\\\AbstractApplication:set",
            ]
        }
    ],
    "providers": [
        {
            "name": "config",
            "lookup_strings": [
                {config}
            ]
        }
    ]
}
TMPL;

        $array = $config->flatten();

        $keys = array_map(function ($value) {
            return StringHelper::quote($value, '"');
        }, array_keys($array));

        $data = str_replace('{config}', implode(",\r\n", $keys), $tmpl);

        File::write(WINDWALKER_TEMP . '/ide/config/.ide-toolbox.metadata.json', $data);
    }
1005449
public function prepareConfig($event)
    {
        if (empty($this->batch_type)) {
            $this->batch_type = null;
        }
        if (isset($this->_configObject)) {
            if (!$this->configObject->validate()) {
                $this->addError('config', 'Invalid configuration');
                $event->isValid = false;
                return false;
            }
            try {
                $attributes = $this->configObject->attributes;
                unset($attributes['model']);
                $this->config = json_encode(['class' => get_class($this->configObject), 'attributes' => $attributes]);
            } catch (\Exception $e) {
                \d($this->_configObject);
                exit;
            }
        } else {
            $this->addError('config', 'Need to provide configuration for this subscription');
            $event->isValid = false;
            return false;
        }
    }
373753
public static function createConfigJson( Event $event ) {
		if ( ! defined( 'WPEMERGE_CLI_DIR' ) ) {
			define( 'WPEMERGE_CLI_DIR', dirname( __DIR__ ) );
		}

		$input = new ArrayInput( [ 'config:create' ] );
		$output = new BufferedOutput();

		try {
			$application = static::create();
			$command = $application->find('config:create');
			$command->run( $input, $output );
			$event->getIO()->write( $output->fetch() );
		} catch ( RuntimeException $e ) {
			$event->getIO()->write( '<error>' . $e->getMessage() . '</error>' );
		}
	}
271232
protected static function instantiateConsoleInteraction(Event $event) {
        $consoleIO                = $event->getIO();
        self::$consoleInteraction = new ConsoleInteraction(new Input($consoleIO), new Output($consoleIO));
    }
522996
protected static function getConfig(Event $event)
    {
        $key   = static::getExtraKey();
        $extra = $event->getComposer()->getPackage()->getExtra();

        $configFile = isset($extra[$key])
                      && isset($extra[$key]['config-file'])
            ? $extra[$key]['config-file']
            : '_config/defaults.php';

        $configPrefix = isset($extra[$key])
                        && isset($extra[$key]['config-prefix'])
            ? $extra[$key]['config-prefix']
            : 'BrightNucleus/Boilerplate';

        return ConfigFactory::create(__DIR__ . '/../' . $configFile)
                            ->getSubConfig($configPrefix);
    }
227847
protected function doSendEvent(Event $event): void
    {
        $envelope = new TransportEnvelope($event, 'json');
        $this->client->putRecord([
            'StreamName'   => $this->router->forEvent($event),
            'PartitionKey' => $this->router->partitionForEvent($event),
            'Data'         => $envelope->toString(),
        ]);
    }
999636
public static function updateCito(Event $event)
    {
        $options = static::getOptions($event);
        $configDir = $options['symfony-config-dir'];
        $templateDir = $options['symfony-template-dir'];
        $fs = new Filesystem();

        /*
         * Update config/packages/cito.yaml
         */
        $yaml = Yaml::parseFile($configDir . '/packages/cito.yaml');
        if (!array_key_exists('user_agent_enabled', $yaml['cito'])) {
            $yaml['cito']['user_agent_enabled'] = false;
        }
        if (!array_key_exists('default_user_agent', $yaml['cito'])) {
            $yaml['cito']['default_user_agent'] = 'new';
        }
        if (!array_key_exists('user_agent_routing', $yaml['cito'])) {
            $yaml['cito']['user_agent_routing'] = [
                'new' => 'ie 11, opera > 52',
                'old' => 'ie < 11, opera < 52'
            ];
        }
        if (!array_key_exists('translation_enabled', $yaml['cito'])) {
            $yaml['cito']['translation_enabled'] = false;
        }
        if (!array_key_exists('translation_support', $yaml['cito'])) {
            $yaml['cito']['translation_support'] = [
                'de' => 'Deutsch',
                'en' => 'Englisch'
            ];
        }

        $fs->remove($configDir . '/packages/cito.yaml');
        $fs->dumpFile($configDir . '/packages/cito.yaml', Yaml::dump($yaml, 99));
    }