本文整理汇总了PHP中Symfony\Component\HttpKernel\KernelInterface::boot方法的典型用法代码示例。如果您正苦于以下问题:PHP KernelInterface::boot方法的具体用法?PHP KernelInterface::boot怎么用?PHP KernelInterface::boot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\KernelInterface
的用法示例。
在下文中一共展示了KernelInterface::boot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Set up test
*/
public function setUp()
{
static::$kernel = static::createKernel();
static::$kernel->boot();
static::$application = new Application(static::$kernel);
static::$application->setAutoExit(false);
}
示例2: setUp
public function setUp()
{
static::$kernel = static::createKernel();
static::$kernel->boot();
$this->dm = static::$kernel->getContainer()->get('doctrine.odm.mongodb.document_manager');
parent::setUp();
}
示例3: getRouter
/**
* @return RouterInterface
*/
private function getRouter()
{
if (null === $this->router) {
$this->kernel->boot();
$this->router = $this->kernel->getContainer()->get('router');
}
return $this->router;
}
示例4: initKernel
private static function initKernel()
{
static::$kernel = static::createKernel();
static::$kernel->boot();
static::$container = static::$kernel->getContainer();
static::$doctrine = static::$container->get('doctrine');
static::$om = static::$doctrine->getManager();
}
示例5: setKernel
/**
* {@inheritdoc}
*/
public function setKernel(KernelInterface $kernel)
{
$this->kernel = $kernel;
if (null === self::$sharedKernel) {
self::$sharedKernel = clone $kernel;
self::$sharedKernel->boot();
}
}
示例6: getContainer
/**
* @return ContainerInterface
*/
private function getContainer()
{
if ($this->kernel === null) {
$this->kernel = $this->createKernel();
$this->kernel->boot();
}
return $this->kernel->getContainer();
}
示例7: getIterator
/**
* Returns an iterator that provides Twig template paths.
*
* @return \Traversable
*/
public function getIterator()
{
$this->kernel->boot();
$viewDirectories = $this->getPossibleViewDirectories();
$viewDirectories = $this->removeNotExistingDirectories($viewDirectories);
$templates = $this->getTwigTemplatesIn($viewDirectories);
return new \ArrayIterator($templates);
}
示例8: getContainer
/**
* @return ContainerInterface
*/
protected function getContainer()
{
if ($this->kernel === NULL) {
$this->kernel = $this->createKernel();
$this->kernel->boot();
}
return $this->kernel->getContainer();
}
示例9: buildClient
/**
* Build client
*
* @return $this Self object
*/
public function buildClient()
{
$this->kernel = new \AppKernel('test', false);
$this->kernel->boot();
$this->session->clear();
$this->client = $this->kernel->getContainer()->get('test.client');
$this->environmentBuilder->setUp($this->kernel);
}
示例10: setUp
public function setUp()
{
static::$kernel = static::createKernel();
static::$kernel->boot();
$this->client = static::createClient([], ['HTTP_HOST' => static::$httpHost]);
$this->dm = static::$kernel->getContainer()->get('doctrine.odm.mongodb.document_manager');
$this->um = static::$kernel->getContainer()->get('backend.user.manager');
$this->locales = explode("|", static::$kernel->getContainer()->getParameter('locales'));
$this->api = array('frontend' => static::$kernel->getContainer()->getParameter('frontend_api'), 'backend' => static::$kernel->getContainer()->getParameter('backend_api'));
parent::setUp();
}
示例11: createClient
/**
* Creates a Client.
*
* @param array $options An array of options to pass to the createKernel class
* @param array $server An array of server parameters
*
* @return Client A Client instance
*/
protected static function createClient(array $options = array(), array $server = array())
{
if (null !== static::$kernel) {
static::$kernel->shutdown();
}
static::$kernel = static::createKernel($options);
static::$kernel->boot();
$client = static::$kernel->getContainer()->get('test.client');
$client->setServerParameters($server);
return $client;
}
示例12: setUp
public function setUp()
{
// Boot the AppKernel in the test environment and with the debug.
$this->kernel = new \AppKernel('test', true);
$this->kernel->boot();
// Store the container and the entity manager in test case properties
$this->container = $this->kernel->getContainer();
$this->entityManager = $this->container->get('doctrine')->getEntityManager();
// Build the schema for sqlite
$this->generateSchema();
parent::setUp();
}
示例13: setUp
protected function setUp()
{
if (!isset($this->serviceName)) {
throw new Exception("Service name has to be set");
}
$this->_kernel = $this->createKernel();
$this->_kernel->boot();
try {
$this->manager = $this->_kernel->getContainer()->get($this->serviceName);
} catch (ServiceNotFoundException $notFoundException) {
throw new Exception("The service " . $this->serviceName . " has to be registered.");
}
}
示例14: setUpBeforeClass
/**
* Set up before class.
*
* @throws RuntimeException unable to start the application
*/
public static function setUpBeforeClass()
{
try {
static::$kernel = static::createKernel();
static::$kernel->boot();
static::$application = new Application(static::$kernel);
static::$application->setAutoExit(false);
static::$container = static::$kernel->getContainer();
} catch (Exception $e) {
throw new RuntimeException(sprintf('Unable to start the application: %s', $e->getMessage()), $e->getCode(), $e);
}
static::createSchema();
}
示例15: doRequest
/**
* {@inheritdoc}
*/
protected function doRequest($request)
{
if ($this->hasPerformedRequest) {
$this->kernel->shutdown();
$this->kernel->boot();
} else {
$this->hasPerformedRequest = true;
}
$this->refreshDoctrineConnection();
$response = $this->kernel->handle($request);
if ($this->kernel instanceof TerminableInterface) {
$this->kernel->terminate($request, $response);
}
return $response;
}