Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
setEntityNamespaces example
$config
??= self::
createTestConfiguration
(
)
;
$eventManager
=
new
EventManager
(
)
;
return
new
EntityManager
(
DriverManager::
getConnection
(
$params
,
$config
,
$eventManager
)
,
$config
,
$eventManager
)
;
}
public
static
function
createTestConfiguration
(
)
: Configuration
{
$config
= ORMSetup::
createConfiguration
(
true
)
;
$config
->
setEntityNamespaces
(
[
'SymfonyTestsDoctrine' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'
]
)
;
$config
->
setAutoGenerateProxyClasses
(
true
)
;
$config
->
setProxyDir
(
sys_get_temp_dir
(
)
)
;
$config
->
setProxyNamespace
(
'SymfonyTests\Doctrine'
)
;
$config
->
setMetadataDriverImpl
(
new
AttributeDriver
(
[
__DIR__.'/../Tests/Fixtures' => 'Symfony\Bridge\Doctrine\Tests\Fixtures'
]
, true
)
)
;
if
(
class_exists
(
DefaultSchemaManagerFactory::
class
)
)
{
$config
->
setSchemaManagerFactory
(
new
DefaultSchemaManagerFactory
(
)
)
;
}
$config
->
setLazyGhostObjectEnabled
(
true
)
;
return
$config
;
}