Exemplo n.º 1
0
 protected function beforeKernel()
 {
     $this->enforceSomeValue();
     parent::beforeKernel();
 }
Exemplo n.º 2
0
<?php

use WMC\AppLoader\AppLoader;
$loader = (require __DIR__ . '/../app/autoload.php');
$app_loader = new AppLoader(__DIR__ . '/../app', $loader);
$app_loader->handleRequest();
 public static function buildParameters(Event $event)
 {
     $extras = $event->getComposer()->getPackage()->getExtra();
     if (empty($extras['wmc-app-loader']['file'])) {
         if (empty($extras['symfony-app-dir'])) {
             throw new \InvalidArgumentException('Either extra.symfony-app-dir or extra.wmc-app-loader.file setting are required to use this script handler.');
         }
         $appDir = $extras['symfony-app-dir'];
         $appLoader = new AppLoader($appDir, null);
         $realFile = $appLoader->getDefaultOptionsFile();
     } else {
         $realFile = $extras['wmc-app-loader']['file'];
     }
     if (empty($extras['wmc-app-loader']['dist-file'])) {
         $distFile = $realFile . '.dist';
         if (!is_file($distFile)) {
             // using packaged dist file
             $distFile = PackageLocator::getPackagePath($event->getComposer(), 'wemakecustom/symfony-app-loader') . '/app/config/app_loader.ini.dist';
         }
     } else {
         $distFile = $extras['wmc-app-loader']['dist-file'];
     }
     $keepOutdatedParams = false;
     if (isset($extras['wmc-app-loader']['keep-outdated'])) {
         $keepOutdatedParams = (bool) $extras['wmc-app-loader']['keep-outdated'];
     }
     $updater = Utils::createConfigFileUpdate($event->getIO());
     $updater->getConfigMerger()->setKeepOutdatedParams($keepOutdatedParams);
     $updater->updateFile($realFile, $distFile);
 }