-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-31588: Introduced eZ\Bundle\EzPublishCoreBundle\DependencyInjecti…
…on\Compiler\TaggedServiceIdsIterator\BackwardCompatibleIterator
- Loading branch information
Showing
9 changed files
with
262 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...lish/Core/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace eZ\Publish\Core\Base\Container\Compiler\TaggedServiceIdsIterator; | ||
|
||
use Iterator; | ||
use IteratorAggregate; | ||
use Symfony\Component\DependencyInjection\TaggedContainerInterface; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class BackwardCompatibleIterator implements IteratorAggregate | ||
{ | ||
/** @var \Symfony\Component\DependencyInjection\TaggedContainerInterface */ | ||
private $container; | ||
|
||
/** @var string */ | ||
private $serviceTag; | ||
|
||
/** @var string */ | ||
private $deprecatedServiceTag; | ||
|
||
public function __construct(TaggedContainerInterface $container, string $serviceTag, string $deprecatedServiceTag) | ||
{ | ||
$this->container = $container; | ||
$this->serviceTag = $serviceTag; | ||
$this->deprecatedServiceTag = $deprecatedServiceTag; | ||
} | ||
|
||
public function getIterator(): Iterator | ||
{ | ||
$serviceIdsWithDeprecatedTags = $this->container->findTaggedServiceIds($this->deprecatedServiceTag); | ||
foreach ($serviceIdsWithDeprecatedTags as $serviceId => $tags) { | ||
@trigger_error( | ||
sprintf( | ||
'Service tag `%s` is deprecated and will be removed in eZ Platform 4.0. Tag %s with `%s` instead.', | ||
$this->deprecatedServiceTag, | ||
$serviceId, | ||
$this->serviceTag | ||
), | ||
E_USER_DEPRECATED | ||
); | ||
|
||
yield $serviceId => $tags; | ||
} | ||
|
||
$taggedServiceIds = $this->container->findTaggedServiceIds($this->serviceTag); | ||
foreach ($taggedServiceIds as $serviceId => $tags) { | ||
yield $serviceId => $tags; | ||
} | ||
|
||
yield from []; | ||
} | ||
} |
Oops, something went wrong.