Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\rest;
|
Chris@0
|
4
|
Chris@0
|
5 use Drupal\Core\DependencyInjection\ContainerBuilder;
|
Chris@0
|
6 use Drupal\Core\DependencyInjection\ServiceProviderInterface;
|
Chris@0
|
7 use Drupal\rest\LinkManager\LinkManager;
|
Chris@0
|
8 use Drupal\rest\LinkManager\RelationLinkManager;
|
Chris@0
|
9 use Drupal\rest\LinkManager\TypeLinkManager;
|
Chris@14
|
10 use Symfony\Component\DependencyInjection\ChildDefinition;
|
Chris@0
|
11 use Symfony\Component\DependencyInjection\Reference;
|
Chris@0
|
12
|
Chris@0
|
13 /**
|
Chris@0
|
14 * Provides BC services.
|
Chris@0
|
15 *
|
Chris@0
|
16 * These services are not added via rest.services.yml because the service
|
Chris@0
|
17 * classes extend classes from the HAL module. They also have no use without
|
Chris@0
|
18 * that module.
|
Chris@0
|
19 */
|
Chris@0
|
20 class RestServiceProvider implements ServiceProviderInterface {
|
Chris@0
|
21
|
Chris@0
|
22 /**
|
Chris@0
|
23 * {@inheritdoc}
|
Chris@0
|
24 */
|
Chris@0
|
25 public function register(ContainerBuilder $container) {
|
Chris@0
|
26 $modules = $container->getParameter(('container.modules'));
|
Chris@0
|
27 if (isset($modules['hal'])) {
|
Chris@0
|
28 // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
Chris@0
|
29 // Use hal.link_manager instead.
|
Chris@0
|
30 // @see https://www.drupal.org/node/2830467
|
Chris@14
|
31 $service_definition = new ChildDefinition(new Reference('hal.link_manager'));
|
Chris@0
|
32 $service_definition->setClass(LinkManager::class);
|
Chris@0
|
33 $container->setDefinition('rest.link_manager', $service_definition);
|
Chris@0
|
34
|
Chris@0
|
35 // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
Chris@0
|
36 // Use hal.link_manager.type instead.
|
Chris@0
|
37 // @see https://www.drupal.org/node/2830467
|
Chris@14
|
38 $service_definition = new ChildDefinition(new Reference('hal.link_manager.type'));
|
Chris@0
|
39 $service_definition->setClass(TypeLinkManager::class);
|
Chris@0
|
40 $container->setDefinition('rest.link_manager.type', $service_definition);
|
Chris@0
|
41
|
Chris@0
|
42 // @deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0.
|
Chris@0
|
43 // Use hal.link_manager.relation instead.
|
Chris@0
|
44 // @see https://www.drupal.org/node/2830467
|
Chris@14
|
45 $service_definition = new ChildDefinition(new Reference('hal.link_manager.relation'));
|
Chris@0
|
46 $service_definition->setClass(RelationLinkManager::class);
|
Chris@0
|
47 $container->setDefinition('rest.link_manager.relation', $service_definition);
|
Chris@0
|
48 }
|
Chris@0
|
49 }
|
Chris@0
|
50
|
Chris@0
|
51 }
|