Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
generateProxyClasses example
elseif
(
!
is_writable
(
$proxyCacheDir
)
)
{
throw
new
\
RuntimeException
(
sprintf
(
'The Doctrine Proxy directory "%s" is not writeable for the current system user.',
$proxyCacheDir
)
)
;
}
// if proxies are autogenerated we don't need to generate them in the cache warmer
if
(
$em
->
getConfiguration
(
)
->
getAutoGenerateProxyClasses
(
)
)
{
continue
;
}
$classes
=
$em
->
getMetadataFactory
(
)
->
getAllMetadata
(
)
;
$em
->
getProxyFactory
(
)
->
generateProxyClasses
(
$classes
)
;
foreach
(
scandir
(
$proxyCacheDir
)
as
$file
)
{
if
(
!
is_dir
(
$file
=
$proxyCacheDir
.'/'.
$file
)
)
{
$files
[
]
=
$file
;
}
}
}
return
$files
;
}
}
$regex
=
sprintf
(
'(%s%s)?',
preg_quote
(
\DIRECTORY_SEPARATOR.
$dir
[
$i
]
, '#'
)
,
$regex
)
;
}
do
{
$regex
=
preg_quote
(
\DIRECTORY_SEPARATOR.
$dir
[
$i
]
, '#'
)
.
$regex
;
}
while
(
0 < --
$i
)
;
$this
->targetDirRegex = '#(^|file://|[:;, \|\r\n])'.
preg_quote
(
$dir
[
0
]
, '#'
)
.
$regex
.'#';
}
}
$proxyClasses
=
$this
->inlineFactories ?
$this
->
generateProxyClasses
(
)
: null;
if
(
$options
[
'preload_classes'
]
)
{
$this
->preload =
array_combine
(
$options
[
'preload_classes'
]
,
$options
[
'preload_classes'
]
)
;
}
$code
=
$this
->
addDefaultParametersMethod
(
)
;
$code
=
$this
->
startClass
(
$options
[
'class'
]
,
$baseClass
,
$this
->inlineFactories &&
$proxyClasses
)
.
$this
->
addServices
(
$services
)
.
$this
->
addDeprecatedAliases
(
)
.
$code
;
$regex
=
sprintf
(
'(%s%s)?',
preg_quote
(
\DIRECTORY_SEPARATOR.
$dir
[
$i
]
, '#'
)
,
$regex
)
;
}
do
{
$regex
=
preg_quote
(
\DIRECTORY_SEPARATOR.
$dir
[
$i
]
, '#'
)
.
$regex
;
}
while
(
0 < --
$i
)
;
$this
->targetDirRegex = '#(^|file://|[:;, \|\r\n])'.
preg_quote
(
$dir
[
0
]
, '#'
)
.
$regex
.'#';
}
}
$proxyClasses
=
$this
->inlineFactories ?
$this
->
generateProxyClasses
(
)
: null;
if
(
$options
[
'preload_classes'
]
)
{
$this
->preload =
array_combine
(
$options
[
'preload_classes'
]
,
$options
[
'preload_classes'
]
)
;
}
$code
=
$this
->
startClass
(
$options
[
'class'
]
,
$baseClass
)
.
$this
->
addServices
(
$services
)
.
$this
->
addDeprecatedAliases
(
)
.
$this
->
addDefaultParametersMethod
(
)
;
$tableName
=
$metaData
->
getTableName
(
)
;
if
(
!
str_contains
(
$tableName
, '_attributes'
)
)
{
continue
;
}
if
(
!
empty
(
$tableNames
)
&& !\
in_array
(
$tableName
,
$tableNames
, true
)
)
{
continue
;
}
$attributeMetaData
[
]
=
$metaData
;
}
$proxyFactory
->
generateProxyClasses
(
$attributeMetaData
)
;
}
/** * Generates Doctrine proxy classes */
public
function
regenerateProxies
(
)
{
$metadata
=
$this
->
getMetadataFactory
(
)
->
getAllMetadata
(
)
;
$proxyFactory
=
$this
->
getProxyFactory
(
)
;
$proxyFactory
->
generateProxyClasses
(
$metadata
)
;
}
$regex
=
sprintf
(
'(%s%s)?',
preg_quote
(
\DIRECTORY_SEPARATOR.
$dir
[
$i
]
, '#'
)
,
$regex
)
;
}
do
{
$regex
=
preg_quote
(
\DIRECTORY_SEPARATOR.
$dir
[
$i
]
, '#'
)
.
$regex
;
}
while
(
0 < --
$i
)
;
$this
->targetDirRegex = '#(^|file://|[:;, \|\r\n])'.
preg_quote
(
$dir
[
0
]
, '#'
)
.
$regex
.'#';
}
}
$proxyClasses
=
$this
->inlineFactories ?
$this
->
generateProxyClasses
(
)
: null;
if
(
$options
[
'preload_classes'
]
)
{
$this
->preload =
array_combine
(
$options
[
'preload_classes'
]
,
$options
[
'preload_classes'
]
)
;
}
$code
=
$this
->
addDefaultParametersMethod
(
)
;
$code
=
$this
->
startClass
(
$options
[
'class'
]
,
$baseClass
,
$this
->inlineFactories &&
$proxyClasses
)
.
$this
->
addServices
(
$services
)
.
$this
->
addDeprecatedAliases
(
)
.
$code
;