Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
registerContainerConfiguration example
if
(
false === @
mkdir
(
$dir
, 0777, true
)
&& !
is_dir
(
$dir
)
)
{
throw
new
\
RuntimeException
(
sprintf
(
'Unable to create the "%s" directory (%s).',
$name
,
$dir
)
)
;
}
}
elseif
(
!
is_writable
(
$dir
)
)
{
throw
new
\
RuntimeException
(
sprintf
(
'Unable to write in the "%s" directory (%s).',
$name
,
$dir
)
)
;
}
}
$container
=
$this
->
getContainerBuilder
(
)
;
$container
->
addObjectResource
(
$this
)
;
$this
->
prepareContainer
(
$container
)
;
$this
->
registerContainerConfiguration
(
$this
->
getContainerLoader
(
$container
)
)
;
$container
->
addCompilerPass
(
new
AddAnnotatedClassesToCachePass
(
$this
)
)
;
return
$container
;
}
/** * Prepares the ContainerBuilder before it is compiled. * * @return void */
throw
new
RuntimeException
(
sprintf
(
"Unable to create the %s directory (%s)\n",
$name
,
$dir
)
)
;
}
}
elseif
(
!
is_writable
(
$dir
)
)
{
throw
new
RuntimeException
(
sprintf
(
"Unable to write in the %s directory (%s)\n",
$name
,
$dir
)
)
;
}
}
$container
=
$this
->
getContainerBuilder
(
)
;
$container
->
addObjectResource
(
$this
)
;
$this
->
prepareContainer
(
$container
)
;
if
(
null !==
$cont
=
$this
->
registerContainerConfiguration
(
$this
->
getContainerLoader
(
$container
)
)
)
{
$container
->
merge
(
$cont
)
;
}
return
$container
;
}
/** * Prepares the ContainerBuilder before it is compiled. * * @param ContainerBuilder $container A ContainerBuilder instance * * @throws Exception */
if
(
false === @
mkdir
(
$dir
, 0777, true
)
&& !
is_dir
(
$dir
)
)
{
throw
new
\
RuntimeException
(
sprintf
(
'Unable to create the "%s" directory (%s).',
$name
,
$dir
)
)
;
}
}
elseif
(
!
is_writable
(
$dir
)
)
{
throw
new
\
RuntimeException
(
sprintf
(
'Unable to write in the "%s" directory (%s).',
$name
,
$dir
)
)
;
}
}
$container
=
$this
->
getContainerBuilder
(
)
;
$container
->
addObjectResource
(
$this
)
;
$this
->
prepareContainer
(
$container
)
;
$this
->
registerContainerConfiguration
(
$this
->
getContainerLoader
(
$container
)
)
;
$container
->
addCompilerPass
(
new
AddAnnotatedClassesToCachePass
(
$this
)
)
;
return
$container
;
}
/** * Prepares the ContainerBuilder before it is compiled. * * @return void */
return
$this
->kernel->
handle
(
...\
func_get_args
(
)
)
;
}
public
function
registerBundles
(
)
: iterable
{
return
$this
->kernel->
registerBundles
(
)
;
}
public
function
registerContainerConfiguration
(
LoaderInterface
$loader
)
: void
{
$this
->kernel->
registerContainerConfiguration
(
...\
func_get_args
(
)
)
;
}
public
function
boot
(
)
: void
{
$this
->kernel->
boot
(
)
;
}
public
function
shutdown
(
)
: void
{
$this
->kernel->
shutdown
(
)
;
}
public
function
testRoutingRouteLoaderTagIsAdded
(
)
{
$frameworkExtension
=
$this
->
createMock
(
ExtensionInterface::
class
)
;
$frameworkExtension
->
expects
(
$this
->
atLeastOnce
(
)
)
->
method
(
'getAlias'
)
->
willReturn
(
'framework'
)
;
$container
=
new
ContainerBuilder
(
)
;
$container
->
registerExtension
(
$frameworkExtension
)
;
$kernel
=
$this
->kernel =
new
ConcreteMicroKernel
(
'test', false
)
;
$kernel
->
registerContainerConfiguration
(
new
ClosureLoader
(
$container
)
)
;
$this
->
assertTrue
(
$container
->
getDefinition
(
'kernel'
)
->
hasTag
(
'routing.route_loader'
)
)
;
}
public
function
testFlexStyle
(
)
{
$kernel
=
new
FlexStyleMicroKernel
(
'test', false
)
;
$kernel
->
boot
(
)
;
$request
= Request::
create
(
'/'
)
;
$response
=
$kernel
->
handle
(
$request
)
;