| @@ 24-83 (lines=60) @@ | ||
| 21 | /** |
|
| 22 | * @deprecated Deprecated since 6.0, will be removed in 6.1. Use the ServiceAwareMatcherFactory instead. |
|
| 23 | */ |
|
| 24 | class BlockMatcherFactory extends BaseFactory implements SiteAccessAware, ContainerAwareInterface |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var \Symfony\Component\DependencyInjection\ContainerInterface |
|
| 28 | */ |
|
| 29 | private $container; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var \eZ\Publish\Core\MVC\ConfigResolverInterface; |
|
| 33 | */ |
|
| 34 | private $configResolver; |
|
| 35 | ||
| 36 | public function __construct(ConfigResolverInterface $configResolver, Repository $repository) |
|
| 37 | { |
|
| 38 | @trigger_error( |
|
| 39 | "BlockMatcherFactory is deprecated, and will be removed in ezpublish-kernel 6.1.\n" . |
|
| 40 | 'Use the ServiceAwareMatcherFactory with the relative namespace as a constructor argument.', |
|
| 41 | E_USER_DEPRECATED |
|
| 42 | ); |
|
| 43 | ||
| 44 | $this->configResolver = $configResolver; |
|
| 45 | parent::__construct( |
|
| 46 | $repository, |
|
| 47 | $this->configResolver->getParameter('block_view') |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function setContainer(ContainerInterface $container = null) |
|
| 52 | { |
|
| 53 | $this->container = $container; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @param string $matcherIdentifier |
|
| 58 | * |
|
| 59 | * @return \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MatcherInterface |
|
| 60 | */ |
|
| 61 | protected function getMatcher($matcherIdentifier) |
|
| 62 | { |
|
| 63 | if ($this->container->has($matcherIdentifier)) { |
|
| 64 | return $this->container->get($matcherIdentifier); |
|
| 65 | } |
|
| 66 | ||
| 67 | return parent::getMatcher($matcherIdentifier); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Changes internal configuration to use the one for passed SiteAccess. |
|
| 72 | * |
|
| 73 | * @param SiteAccess $siteAccess |
|
| 74 | */ |
|
| 75 | public function setSiteAccess(SiteAccess $siteAccess = null) |
|
| 76 | { |
|
| 77 | if ($siteAccess === null) { |
|
| 78 | return; |
|
| 79 | } |
|
| 80 | ||
| 81 | $this->matchConfig = $this->configResolver->getParameter('block_view', 'ezsettings', $siteAccess->name); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 24-83 (lines=60) @@ | ||
| 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 | /** |
|
| 27 | * @var \Symfony\Component\DependencyInjection\ContainerInterface |
|
| 28 | */ |
|
| 29 | private $container; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var \eZ\Publish\Core\MVC\ConfigResolverInterface; |
|
| 33 | */ |
|
| 34 | private $configResolver; |
|
| 35 | ||
| 36 | public function __construct(ConfigResolverInterface $configResolver, Repository $repository) |
|
| 37 | { |
|
| 38 | @trigger_error( |
|
| 39 | "ContentMatcherFactory is deprecated, and will be removed in ezpublish-kernel 6.1.\n" . |
|
| 40 | 'Use the ServiceAwareMatcherFactory with the relative namespace as a constructor argument.', |
|
| 41 | E_USER_DEPRECATED |
|
| 42 | ); |
|
| 43 | ||
| 44 | $this->configResolver = $configResolver; |
|
| 45 | parent::__construct( |
|
| 46 | $repository, |
|
| 47 | $this->configResolver->getParameter('content_view') |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function setContainer(ContainerInterface $container = null) |
|
| 52 | { |
|
| 53 | $this->container = $container; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @param string $matcherIdentifier |
|
| 58 | * |
|
| 59 | * @return \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MatcherInterface |
|
| 60 | */ |
|
| 61 | protected function getMatcher($matcherIdentifier) |
|
| 62 | { |
|
| 63 | if ($this->container->has($matcherIdentifier)) { |
|
| 64 | return $this->container->get($matcherIdentifier); |
|
| 65 | } |
|
| 66 | ||
| 67 | return parent::getMatcher($matcherIdentifier); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Changes internal configuration to use the one for passed SiteAccess. |
|
| 72 | * |
|
| 73 | * @param SiteAccess $siteAccess |
|
| 74 | */ |
|
| 75 | public function setSiteAccess(SiteAccess $siteAccess = null) |
|
| 76 | { |
|
| 77 | if ($siteAccess === null) { |
|
| 78 | return; |
|
| 79 | } |
|
| 80 | ||
| 81 | $this->matchConfig = $this->configResolver->getParameter('content_view', 'ezsettings', $siteAccess->name); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 24-83 (lines=60) @@ | ||
| 21 | /** |
|
| 22 | * @deprecated Deprecated since 6.0, will be removed in 6.1. Location view in general is deprecated. Use content view instead. |
|
| 23 | */ |
|
| 24 | class LocationMatcherFactory extends BaseMatcherFactory implements SiteAccessAware, ContainerAwareInterface |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var \Symfony\Component\DependencyInjection\ContainerInterface |
|
| 28 | */ |
|
| 29 | private $container; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @var \eZ\Publish\Core\MVC\ConfigResolverInterface; |
|
| 33 | */ |
|
| 34 | private $configResolver; |
|
| 35 | ||
| 36 | public function __construct(ConfigResolverInterface $configResolver, Repository $repository) |
|
| 37 | { |
|
| 38 | @trigger_error( |
|
| 39 | "Location view has been deprecated in 6.0, and will be removed in 6.1.\n" . |
|
| 40 | 'Use content view instead.', |
|
| 41 | E_USER_DEPRECATED |
|
| 42 | ); |
|
| 43 | ||
| 44 | $this->configResolver = $configResolver; |
|
| 45 | parent::__construct( |
|
| 46 | $repository, |
|
| 47 | $this->configResolver->getParameter('location_view') |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function setContainer(ContainerInterface $container = null) |
|
| 52 | { |
|
| 53 | $this->container = $container; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @param string $matcherIdentifier |
|
| 58 | * |
|
| 59 | * @return \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MatcherInterface |
|
| 60 | */ |
|
| 61 | protected function getMatcher($matcherIdentifier) |
|
| 62 | { |
|
| 63 | if ($this->container->has($matcherIdentifier)) { |
|
| 64 | return $this->container->get($matcherIdentifier); |
|
| 65 | } |
|
| 66 | ||
| 67 | return parent::getMatcher($matcherIdentifier); |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * Changes internal configuration to use the one for passed SiteAccess. |
|
| 72 | * |
|
| 73 | * @param SiteAccess $siteAccess |
|
| 74 | */ |
|
| 75 | public function setSiteAccess(SiteAccess $siteAccess = null) |
|
| 76 | { |
|
| 77 | if ($siteAccess === null) { |
|
| 78 | return; |
|
| 79 | } |
|
| 80 | ||
| 81 | $this->matchConfig = $this->configResolver->getParameter('location_view', 'ezsettings', $siteAccess->name); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||