1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* File containing the ContentMatcherFactory class. |
5
|
|
|
* |
6
|
|
|
* @copyright Copyright (C) eZ Systems AS. All rights reserved. |
7
|
|
|
* @license For full copyright and license information view LICENSE file distributed with this source code. |
8
|
|
|
* |
9
|
|
|
* @version //autogentag// |
10
|
|
|
*/ |
11
|
|
|
namespace eZ\Bundle\EzPublishCoreBundle\Matcher; |
12
|
|
|
|
13
|
|
|
use eZ\Publish\API\Repository\Repository; |
14
|
|
|
use eZ\Publish\Core\MVC\ConfigResolverInterface; |
15
|
|
|
use eZ\Publish\Core\MVC\Symfony\Matcher\ContentMatcherFactory as BaseFactory; |
16
|
|
|
use eZ\Publish\Core\MVC\Symfony\SiteAccess\SiteAccessAware; |
17
|
|
|
use eZ\Publish\Core\MVC\Symfony\SiteAccess; |
18
|
|
|
use Symfony\Component\DependencyInjection\ContainerAwareInterface; |
19
|
|
|
use Symfony\Component\DependencyInjection\ContainerAwareTrait; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @deprecated Deprecated since 6.0, will be removed in 6.1. Use the ServiceAwareMatcherFactory instead. |
23
|
|
|
*/ |
24
|
|
|
class ContentMatcherFactory extends BaseFactory implements SiteAccessAware, ContainerAwareInterface |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
use ContainerAwareTrait; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var \eZ\Publish\Core\MVC\ConfigResolverInterface; |
30
|
|
|
*/ |
31
|
|
|
private $configResolver; |
32
|
|
|
|
33
|
|
|
public function __construct(ConfigResolverInterface $configResolver, Repository $repository) |
34
|
|
|
{ |
35
|
|
|
@trigger_error( |
|
|
|
|
36
|
|
|
"ContentMatcherFactory is deprecated, and will be removed in ezpublish-kernel 6.1.\n" . |
37
|
|
|
'Use the ServiceAwareMatcherFactory with the relative namespace as a constructor argument.', |
38
|
|
|
E_USER_DEPRECATED |
39
|
|
|
); |
40
|
|
|
|
41
|
|
|
$this->configResolver = $configResolver; |
42
|
|
|
parent::__construct( |
43
|
|
|
$repository, |
44
|
|
|
$this->configResolver->getParameter('content_view') |
45
|
|
|
); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @param string $matcherIdentifier |
50
|
|
|
* |
51
|
|
|
* @return \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MatcherInterface |
52
|
|
|
*/ |
53
|
|
|
protected function getMatcher($matcherIdentifier) |
54
|
|
|
{ |
55
|
|
|
if ($this->container->has($matcherIdentifier)) { |
56
|
|
|
return $this->container->get($matcherIdentifier); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return parent::getMatcher($matcherIdentifier); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Changes internal configuration to use the one for passed SiteAccess. |
64
|
|
|
* |
65
|
|
|
* @param SiteAccess $siteAccess |
66
|
|
|
*/ |
67
|
|
|
public function setSiteAccess(SiteAccess $siteAccess = null) |
68
|
|
|
{ |
69
|
|
|
if ($siteAccess === null) { |
70
|
|
|
return; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
$this->matchConfig = $this->configResolver->getParameter('content_view', 'ezsettings', $siteAccess->name); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.