PHP Classes

File: default_bootstrap_dic.php

Recommend this page to a friend!
  Classes of Jelle Sebreghts   PHP TheSportsDb   default_bootstrap_dic.php   Download  
File: default_bootstrap_dic.php
Role: Configuration script
Content type: text/plain
Description: Configuration script
Class: PHP TheSportsDb
Get game information from the Sports DB site API
Author: By
Last change: Fix Symfony DIC
Start of fix for DIC. TODO: fix circular reference.
Major refactoring, getting closer to production-ready code.
Date: 7 years ago
Size: 710 bytes
 

Contents

Class file image Download
<?php
use HendrichA\TagPassLibrary\TargetedTagPass;
use
Symfony\Component\DependencyInjection\ContainerBuilder;
use
Symfony\Component\Config\FileLocator;
use
Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/config'));
$loader->load('config.yml');

// Compiler pass.
$repositoryTagpass = new TargetedTagPass('entity_repository', 'addRepository');
$container->addCompilerPass($repositoryTagpass);
$entityManagerTagpass = new TargetedTagPass('entity_manager', 'setEntityManager');
$container->addCompilerPass($entityManagerTagpass);
$container->compile();
$db = $container->get('thesportsdb');