Skip to content
This repository
Newer
Older
100644 67 lines (58 sloc) 1.492 kb
94e2c5c1 »
2012-04-02 Added the support for SQL filters
1 <?php
2
3 /*
4 * This file is part of the Doctrine Bundle
5 *
6 * The code was originally distributed inside the Symfony framework.
7 *
8 * (c) Fabien Potencier <fabien@symfony.com>
9 * (c) Doctrine Project, Benjamin Eberlei <kontakt@beberlei.de>
10 *
11 * For the full copyright and license information, please view the LICENSE
12 * file that was distributed with this source code.
13 */
14
15 namespace Doctrine\Bundle\DoctrineBundle;
16
17 use Doctrine\ORM\EntityManager;
18
19 /**
20 * Configurator for an EntityManager
21 *
22 * @author Christophe Coevoet <stof@notk.org>
23 */
24 class ManagerConfigurator
25 {
26 private $enabledFilters = array();
27
28 /**
29 * Construct.
30 *
31 * @param array $enabledFilters
32 */
33 public function __construct(array $enabledFilters)
34 {
35 $this->enabledFilters = $enabledFilters;
36 }
37
38 /**
39 * Create a connection by name.
40 *
41 * @param EntityManager $entityManager
42 */
43 public function configure(EntityManager $entityManager)
44 {
45 $this->enableFilters($entityManager);
46 }
47
f0300fcb »
2012-06-30 added PHPDocs
48 /**
49 * Enable filters for an given entity manager
50 *
51 * @param EntityManager $entityManager
52 *
53 * @return null
54 */
94e2c5c1 »
2012-04-02 Added the support for SQL filters
55 private function enableFilters(EntityManager $entityManager)
56 {
57 if (empty($this->enabledFilters)) {
58 return;
59 }
60
61 $filterCollection = $entityManager->getFilters();
62 foreach ($this->enabledFilters as $filter) {
63 $filterCollection->enable($filter);
64 }
65 }
66 }
Something went wrong with that request. Please try again.