-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDataStoreService.php
More file actions
41 lines (36 loc) · 1.28 KB
/
DataStoreService.php
File metadata and controls
41 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Mapbender\DataSourceBundle\Component;
use Mapbender\DataSourceBundle\Component\Factory\DataStoreFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* @author Andriy Oblivantsev <eslider@gmail.com>
* @deprecated incompatible with Symfony 4 (full container injection); use RepositoryRegistry and inject `mbds.default_datastore_factory`
*/
class DataStoreService extends RepositoryRegistry
{
protected $factoryId = 'mbds.default_datastore_factory';
/**
* @param ContainerInterface $container
* @param mixed[][]|string $declarations repository configs, or container param key for lookup
*/
public function __construct(ContainerInterface $container, $declarations = 'dataStores')
{
/** @var DataStoreFactory $factory */
$factory = $container->get($this->factoryId);
$declarations = $declarations ?: array();
if ($declarations && \is_string($declarations)) {
$declarations = $container->getParameter($declarations);
}
parent::__construct($factory, $declarations ?: array());
}
/**
* Get store by name
*
* @param string $name
* @return DataStore
*/
public function get($name)
{
return $this->getDataStoreByName($name);
}
}