partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

AppKernel.php (5774B)


      1 <?php
      2 
      3 use Symfony\Component\Config\Loader\LoaderInterface;
      4 use Symfony\Component\HttpKernel\Kernel;
      5 
      6 class AppKernel extends Kernel
      7 {
      8     public function registerBundles()
      9     {
     10         // Base 3rd party bundles required for PartKeepr operation
     11         $bundles = [
     12             new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
     13             new Symfony\Bundle\SecurityBundle\SecurityBundle(),
     14             new Symfony\Bundle\TwigBundle\TwigBundle(),
     15             new Symfony\Bundle\MonologBundle\MonologBundle(),
     16             new Symfony\Bundle\AsseticBundle\AsseticBundle(),
     17             new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
     18             new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
     19             new FOS\RestBundle\FOSRestBundle(),
     20             new FOS\UserBundle\FOSUserBundle(),
     21             new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
     22             new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
     23             new PartKeepr\DoctrineReflectionBundle\PartKeeprDoctrineReflectionBundle(),
     24             new PartKeepr\RESTBundle\PartKeeprRESTBundle(),
     25             new Escape\WSSEAuthenticationBundle\EscapeWSSEAuthenticationBundle(),
     26             new SpriteGenerator\SpriteGeneratorBundle(),
     27             new Dunglas\ApiBundle\DunglasApiBundle(),
     28             new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
     29             new Brainbits\FugueIconsBundle\BrainbitsFugueIconsBundle(),
     30             new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
     31             new \PartKeepr\RemoteFileLoader\PartKeeprRemoteFileLoaderBundle(),
     32             new \FR3D\LdapBundle\FR3DLdapBundle(),
     33             new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(),
     34         ];
     35 
     36         // Developer bundles
     37         if (in_array($this->getEnvironment(), ['dev', 'test'])) {
     38             $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
     39             $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
     40             $bundles[] = new Liip\FunctionalTestBundle\LiipFunctionalTestBundle();
     41         }
     42 
     43         // PartKeepr bundles
     44         $bundles[] = new \PartKeepr\SetupBundle\PartKeeprSetupBundle();
     45         $bundles[] = new PartKeepr\CronLoggerBundle\PartKeeprCronLoggerBundle();
     46         $bundles[] = new PartKeepr\CategoryBundle\PartKeeprCategoryBundle();
     47         $bundles[] = new PartKeepr\UploadedFileBundle\PartKeeprUploadedFileBundle();
     48         $bundles[] = new PartKeepr\FrontendBundle\PartKeeprFrontendBundle();
     49         $bundles[] = new PartKeepr\SiPrefixBundle\PartKeeprSiPrefixBundle();
     50         $bundles[] = new PartKeepr\AuthBundle\PartKeeprAuthBundle();
     51         $bundles[] = new PartKeepr\CoreBundle\PartKeeprCoreBundle();
     52         $bundles[] = new PartKeepr\MimetypeIconsBundle\PartKeeprMimetypeIconsBundle();
     53         $bundles[] = new PartKeepr\FootprintBundle\PartKeeprFootprintBundle();
     54         $bundles[] = new PartKeepr\UnitBundle\PartKeeprUnitBundle();
     55         $bundles[] = new PartKeepr\PartBundle\PartKeeprPartBundle();
     56         $bundles[] = new PartKeepr\StockBundle\PartKeeprStockBundle();
     57         $bundles[] = new PartKeepr\DistributorBundle\PartKeeprDistributorBundle();
     58         $bundles[] = new PartKeepr\ManufacturerBundle\PartKeeprManufacturerBundle();
     59         $bundles[] = new PartKeepr\ImageBundle\PartKeeprImageBundle();
     60         $bundles[] = new PartKeepr\ProjectBundle\PartKeeprProjectBundle();
     61         $bundles[] = new PartKeepr\StorageLocationBundle\PartKeeprStorageLocationBundle();
     62         $bundles[] = new PartKeepr\TipOfTheDayBundle\PartKeeprTipOfTheDayBundle();
     63         $bundles[] = new PartKeepr\ExportBundle\PartKeeprExportBundle();
     64         $bundles[] = new PartKeepr\StatisticBundle\PartKeeprStatisticBundle();
     65         $bundles[] = new PartKeepr\SystemPreferenceBundle\PartKeeprSystemPreferenceBundle();
     66         $bundles[] = new PartKeepr\ImportBundle\PartKeeprImportBundle();
     67         $bundles[] = new PartKeepr\BatchJobBundle\PartKeeprBatchJobBundle();
     68         $bundles[] = new PartKeepr\OctoPartBundle\PartKeeprOctoPartBundle();
     69         $bundles[] = new PartKeepr\MobileFrontendBundle\PartKeeprMobileFrontendBundle();
     70 
     71         return array_merge($bundles, $this->getCustomBundles());
     72     }
     73 
     74     /**
     75      * Loads the configuration for an environment. Also loads a custom configuration for non-text environments from
     76      * app/config_config_custom.yml if it exists.
     77      *
     78      * @param $loader LoaderInterface
     79      */
     80     public function registerContainerConfiguration(LoaderInterface $loader)
     81     {
     82         $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
     83 
     84         if ($this->getEnvironment() !== 'test') {
     85             $customConfig = __DIR__.'/config/config_custom.yml';
     86 
     87             if (file_exists($customConfig)) {
     88                 $loader->load($customConfig);
     89             }
     90         }
     91     }
     92 
     93     /**
     94      * Returns any custom bundles for a custom setup. Override this
     95      * method in a custom AppKernel.
     96      *
     97      * @return array
     98      */
     99     public function getCustomBundles()
    100     {
    101         return [];
    102     }
    103 
    104     /**
    105      * Override to allow different cache environments set by the environment variable PARTKEEPR_ENVIRONMENT.
    106      *
    107      * @return string
    108      */
    109     public function getCacheDir()
    110     {
    111         $environment = getenv('PARTKEEPR_ENVIRONMENT');
    112 
    113         if ($environment === false) {
    114             $environment = $this->environment;
    115         }
    116 
    117         return $this->rootDir.'/cache/'.$environment;
    118     }
    119 
    120     /**
    121      * Override to avoid stripping comments.
    122      *
    123      * @see https://github.com/partkeepr/PartKeepr/issues/438
    124      *
    125      * @param string $source
    126      *
    127      * @return string
    128      */
    129     public static function stripComments($source)
    130     {
    131         return $source;
    132     }
    133 }