| Conditions | 1 |
| Paths | 1 |
| Total Lines | 28 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | public function register() |
||
| 28 | { |
||
| 29 | $this->getContainer()->share('entityManager', function () { |
||
| 30 | $config = Setup::createAnnotationMetadataConfiguration( |
||
| 31 | [dirname(__DIR__)], |
||
| 32 | $this->getContainer()->get('config')['debug'] |
||
| 33 | ); |
||
| 34 | |||
| 35 | return EntityManager::create([ |
||
| 36 | 'dbname' => 'blog', |
||
| 37 | 'user' => 'root', |
||
| 38 | 'password' => '', |
||
| 39 | 'host' => 'localhost', |
||
| 40 | 'charset' => 'utf8', |
||
| 41 | 'driver' => 'pdo_mysql' |
||
| 42 | ], $config); |
||
| 43 | }); |
||
| 44 | |||
| 45 | $this->getContainer()->share( |
||
| 46 | PostRepositoryInterface::class, |
||
| 47 | $this->getContainer()->get('entityManager')->getRepository(Post::class) |
||
| 48 | ); |
||
| 49 | |||
| 50 | $this->getContainer()->share( |
||
| 51 | CategoryRepositoryInterface::class, |
||
| 52 | $this->getContainer()->get('entityManager')->getRepository(Category::class) |
||
| 53 | ); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |