|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dtc\QueueBundle\Tests\ORM; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\EntityManager; |
|
6
|
|
|
use Symfony\Component\DependencyInjection\Container; |
|
7
|
|
|
use Doctrine\ORM\Tools\Setup; |
|
8
|
|
|
|
|
9
|
|
|
class ContainerExtended extends Container |
|
10
|
|
|
{ |
|
11
|
|
|
protected $methodMap = ['doctrine.orm.default_entity_manager' => 'getDoctrine_Orm_DefaultEntityManagerService']; |
|
12
|
|
|
|
|
13
|
|
|
public function getDoctrine_Orm_DefaultEntityManagerService($something = false) |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.'/../..'), true, null, null, false); |
|
16
|
|
|
$namingStrategy = new \Doctrine\ORM\Mapping\UnderscoreNamingStrategy(); |
|
17
|
|
|
$config->setNamingStrategy($namingStrategy); |
|
18
|
|
|
$config->addCustomNumericFunction('year', Year::class); |
|
|
|
|
|
|
19
|
|
|
$config->addCustomNumericFunction('month', Month::class); |
|
|
|
|
|
|
20
|
|
|
$config->addCustomNumericFunction('day', Day::class); |
|
|
|
|
|
|
21
|
|
|
$config->addCustomNumericFunction('hour', Hour::class); |
|
|
|
|
|
|
22
|
|
|
$config->addCustomNumericFunction('minute', Minute::class); |
|
|
|
|
|
|
23
|
|
|
$host = getenv('MYSQL_HOST'); |
|
24
|
|
|
$user = getenv('MYSQL_USER'); |
|
25
|
|
|
$port = getenv('MYSQL_PORT') ?: 3306; |
|
26
|
|
|
$password = getenv('MYSQL_PASSWORD'); |
|
27
|
|
|
$db = getenv('MYSQL_DATABASE'); |
|
28
|
|
|
$params = ['host' => $host, |
|
29
|
|
|
'port' => $port, |
|
30
|
|
|
'user' => $user, |
|
31
|
|
|
'driver' => 'mysqli', |
|
32
|
|
|
'password' => $password, |
|
33
|
|
|
'dbname' => $db, ]; |
|
34
|
|
|
|
|
35
|
|
|
return EntityManager::create($params, $config); |
|
36
|
|
|
} |
|
37
|
|
|
} |
|
38
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.