Created
April 15, 2016 08:43
-
-
Save mlebkowski/a2606cb5041ec480a72e3a167eaf6a67 to your computer and use it in GitHub Desktop.
Simple kernel to populate symfony cache for PHPStorm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\Config\Loader\LoaderInterface; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\Routing\RouteCollection; | |
class AppKernel extends Symfony\Component\HttpKernel\Kernel | |
{ | |
public function registerBundles() | |
{ | |
return [ | |
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | |
new Symfony\Bundle\SecurityBundle\SecurityBundle(), | |
new Symfony\Bundle\TwigBundle\TwigBundle(), | |
new Symfony\Bundle\MonologBundle\MonologBundle(), | |
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), | |
new Symfony\Bundle\AsseticBundle\AsseticBundle(), | |
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), | |
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), | |
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), | |
new Kunstmaan\UtilitiesBundle\KunstmaanUtilitiesBundle(), | |
new Kunstmaan\NodeBundle\KunstmaanNodeBundle(), | |
new Kunstmaan\SeoBundle\KunstmaanSeoBundle(), | |
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(), | |
new Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(), | |
new Liip\ImagineBundle\LiipImagineBundle(), | |
new Knp\Bundle\GaufretteBundle\KnpGaufretteBundle(), | |
new Kunstmaan\MediaBundle\KunstmaanMediaBundle(), | |
new FOS\UserBundle\FOSUserBundle(), | |
new Knp\Bundle\MenuBundle\KnpMenuBundle(), | |
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), | |
new Kunstmaan\AdminBundle\KunstmaanAdminBundle(), | |
new Kunstmaan\PagePartBundle\KunstmaanPagePartBundle(), | |
new Kunstmaan\AdminListBundle\KunstmaanAdminListBundle(), | |
new Kunstmaan\MenuBundle\KunstmaanMenuBundle(), | |
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), | |
new Kunstmaan\SitemapBundle\KunstmaanSitemapBundle(), | |
new Kunstmaan\RedirectBundle\KunstmaanRedirectBundle(), | |
new Kunstmaan\UserManagementBundle\KunstmaanUserManagementBundle(), | |
new Kunstmaan\DashboardBundle\KunstmaanDashboardBundle(), | |
]; | |
} | |
public function routing() | |
{ | |
return new RouteCollection(); | |
} | |
/** | |
* Loads the container configuration. | |
* | |
* @param LoaderInterface $loader A LoaderInterface instance | |
* | |
* @api | |
*/ | |
public function registerContainerConfiguration(LoaderInterface $loader) | |
{ | |
$loader->load(function (ContainerBuilder $container) { | |
$container->setParameter('multilanguage', false); | |
$container->setParameter('defaultlocale', false); | |
$container->setParameter('requiredlocales', ''); | |
$container->setParameter('websitetitle', ''); | |
$container->setParameter('google.api.client_id', ''); | |
$container->setParameter('google.api.client_secret', ''); | |
$container->setParameter('google.api.dev_key', ''); | |
$container->loadFromExtension('framework', [ | |
'secret' => "", | |
'session' => null, | |
'form' => null, | |
'templating' => [ | |
'engines' => ['twig'] | |
], | |
'router' => [ | |
'resource' => 'kernel:routing', | |
'type' => 'service' | |
] | |
]); | |
$container->loadFromExtension('security', [ | |
'acl' => [ | |
'connection' => 'default', | |
], | |
'providers' => [ | |
'fos_userbundle' => [ | |
'id' => 'fos_user.user_provider.username', | |
] | |
], | |
'firewalls' => [ | |
'main' => [ | |
'pattern' => '.*', | |
'anonymous' => true, | |
] | |
], | |
]); | |
$container->loadFromExtension('stof_doctrine_extensions', [ | |
'orm' => [ | |
'default' => [ | |
'tree' => true, | |
'loggable' => true, | |
'translatable' => true, | |
'sluggable' => true, | |
], | |
], | |
]); | |
$container->loadFromExtension('doctrine', [ | |
'dbal' => [ | |
'default_connection' => 'default', | |
'connections' => [ | |
'default' => [ | |
'dbname' => null | |
] | |
], | |
], | |
'orm' => [ | |
'auto_generate_proxy_classes' => true, | |
'entity_managers' => [ | |
'default' => [ | |
'auto_mapping' => true, | |
'mappings' => [ | |
'gedmo_translatable' => [ | |
'type' => 'annotation', | |
'prefix' => 'Gedmo\Translatable\Entity', | |
'dir' => "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translatable/Entity", | |
'is_bundle' => false | |
], | |
'gedmo_translator' => [ | |
'type' => 'annotation', | |
'prefix' => 'Gedmo\Translator\Entity', | |
'dir' => "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Translator/Entity", | |
'is_bundle' => false | |
], | |
'gedmo_loggable' => [ | |
'type' => 'annotation', | |
'prefix' => 'Gedmo\Loggable\Entity', | |
'dir' => "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Loggable/Entity", | |
'is_bundle' => false, | |
], | |
'gedmo_tree' => [ | |
'type' => 'annotation', | |
'prefix' => 'Gedmo\Tree\Entity', | |
'dir' => "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity", | |
'is_bundle' => false | |
], | |
], | |
] | |
] | |
] | |
]); | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$loader = require __DIR__ . '/../vendor/autoload.php'; | |
Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass')); | |
require __DIR__ . '/AppKernel.php'; | |
(new Symfony\Bundle\FrameworkBundle\Console\Application(new AppKernel('dev', true)))->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment