Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getMappedClasses example
protected
function
doWarmUp
(
string
$cacheDir
, ArrayAdapter
$arrayAdapter
)
: bool
{
if
(
!
$this
->loaders
)
{
return
true;
}
$metadataFactory
=
new
CacheClassMetadataFactory
(
new
ClassMetadataFactory
(
new
LoaderChain
(
$this
->loaders
)
)
,
$arrayAdapter
)
;
foreach
(
$this
->
extractSupportedLoaders
(
$this
->loaders
)
as
$loader
)
{
foreach
(
$loader
->
getMappedClasses
(
)
as
$mappedClass
)
{
try
{
$metadataFactory
->
getMetadataFor
(
$mappedClass
)
;
}
catch
(
AnnotationException
)
{
// ignore failing annotations
}
catch
(
\Exception
$e
)
{
$this
->
ignoreAutoloadException
(
$mappedClass
,
$e
)
;
}
}
}
return
true;
}
parent::
__construct
(
$phpArrayFile
)
;
$this
->validatorBuilder =
$validatorBuilder
;
}
protected
function
doWarmUp
(
string
$cacheDir
, ArrayAdapter
$arrayAdapter
)
: bool
{
$loaders
=
$this
->validatorBuilder->
getLoaders
(
)
;
$metadataFactory
=
new
LazyLoadingMetadataFactory
(
new
LoaderChain
(
$loaders
)
,
$arrayAdapter
)
;
foreach
(
$this
->
extractSupportedLoaders
(
$loaders
)
as
$loader
)
{
foreach
(
$loader
->
getMappedClasses
(
)
as
$mappedClass
)
{
try
{
if
(
$metadataFactory
->
hasMetadataFor
(
$mappedClass
)
)
{
$metadataFactory
->
getMetadataFor
(
$mappedClass
)
;
}
}
catch
(
AnnotationException
)
{
// ignore failing annotations
}
catch
(
\Exception
$e
)
{
$this
->
ignoreAutoloadException
(
$mappedClass
,
$e
)
;
}
}
}