-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
EZP-30693: Refactored SolrEngineFactory to avoid using container directly #143
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick:
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
* | ||
* @version //autogentag// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been obsolete for a very long time, please skip it in all new files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about unit tests for introduced/modified code?
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('ezpublish.search.solr.core_filter.registry')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extract constant with registry service id?
|
||
$coreFilterRegistryDefinition = $container->getDefinition('ezpublish.search.solr.core_filter.registry'); | ||
|
||
$coreFilters = $container->findTaggedServiceIds('ezpublish.search.solr.core_filter'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extract constant with tag name?
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->hasDefinition('ezpublish.search.solr.gateway.registry')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extract constant with gateway service id?
|
||
$gatewayRegistryDefinition = $container->getDefinition('ezpublish.search.solr.gateway.registry'); | ||
|
||
$gateways = $container->findTaggedServiceIds('ezpublish.search.solr.gateway'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extract constant with tag name?
use Symfony\Component\DependencyInjection\Reference; | ||
use LogicException; | ||
|
||
class CoreFilterRegistryPass implements CompilerPassInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class CoreFilterRegistryPass implements CompilerPassInterface | |
final class CoreFilterRegistryPass implements CompilerPassInterface |
use Symfony\Component\DependencyInjection\Reference; | ||
use LogicException; | ||
|
||
class GatewayRegistryPass implements CompilerPassInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class GatewayRegistryPass implements CompilerPassInterface | |
final class GatewayRegistryPass implements CompilerPassInterface |
use EzSystems\EzPlatformSolrSearchEngine\CoreFilter; | ||
use OutOfBoundsException; | ||
|
||
class CoreFilterRegistry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class CoreFilterRegistry | |
final class CoreFilterRegistry |
lib/Gateway/GatewayRegistry.php
Outdated
/** | ||
* Registry for Solr search engine coreFilters. | ||
*/ | ||
class GatewayRegistry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class GatewayRegistry | |
final class GatewayRegistry |
@adamwojs We are still looking for a volunteer. :) |
We're run out of juniors and interns :P |
@adamwojs What exactly do you want to test? I'm fine with Compiler Passes but there is little sense in testing Registries as they only contain getters and setters. |
Tests for Compiler Passes should be enough. Personally, I think registries are also worth to cover in tests: there are still services, even if it's logic is very simple. But this is my personal opinion. BTW. Failed CI build seems to be relevant 😉 |
@adamwojs Added tests for Registries and CompilerPasses. Travis should be green now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works now! 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA approve
Introduced registries and service tagging to allow fetching Gateways and CoreFilters for given connection. This avoid direct
Container::get
calls and let us keep services private.