-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EZP-31588: As a Developer I want to configure search engine features with tags which follows same convention #51
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.
I like the idea of common abstraction for BC layer.
What we can't have is a squash commit assigned to this specific Story in Release notes, but containing all this stuff (too unrelated). Could you, after review, but before QA, squash commits in such way we could merge it in a fast-forward way? One for BC layer, N for compiler passes related to specific features, and finally one for EZP-31588, prefixed with that ticket number.
eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Compiler/RegisterSearchEngineIndexerPass.php
Outdated
Show resolved
Hide resolved
eZ/Bundle/EzPublishCoreBundle/DependencyInjection/Compiler/RegisterSearchEnginePass.php
Outdated
Show resolved
Hide resolved
eZ/Publish/Core/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php
Show resolved
Hide resolved
* | ||
* @internal | ||
*/ | ||
final class DeprecationErrorCaptor |
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.
Does this captor demand a ransom? ;)
I'm not really sold on this naming, the most commonly used name for this kind of classes is Collector, I think. Unless this follows some kind of existing pattern?
General question: why do you need to add extra complexity to error handling? We rather rely on Monolog and Symfony Console handlers on that. Is it just to be able to process those errors in unit tests? For that we usually rely on warnings being converted to exceptions and validate them by ->expectException
. Doesn't this work here?
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.
I'm not really sold on this naming, the most commonly used name for this kind of classes is Collector, I think. Unless this follows some kind of existing pattern?
It was inspirated by https://www.javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/ArgumentCaptor.html but collector seems to be better naming choice,
General question: why do you need to add extra complexity to error handling? We rather rely on Monolog and Symfony Console handlers on that. Is it just to be able to process those errors in unit tests? For that we usually rely on warnings being converted to exceptions and validate them by ->expectException. Doesn't this work here?
There are dedicated ->expectDeprecation(...)
, ->expectDeprecationMessage(...)
but for some reason they doesn't work. I need to figure out why.
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.
->expectDeprecation(...)
and ->expectDeprecationMessage(...)
only works when the deprecation message is triggered without error suppression operator (`@`) e.g.
trigger_error('Lorem ipsum dolor...', E_USER_DEPRECATED) // OK
@trigger_error('Lorem ipsum dolor...', E_USER_DEPRECATED) // KO
Sure, but I would do only one commit for |
Fine by me. However please do not copy JIRA story format in commit message, it's not very useful for browsing commit history (again, it's a history, so it's the past anyway...[1] ;)). Release Notes contain full JIRA title, so it's fine. [1] it's really not a mistake per se, it's a matter of keeping common convention. I hope at some point we'll achieve that... OT: after "As a Developer" there should be no comma. I don't know who started to introduce this grammar mistake :-) |
eZ/Publish/Core/Base/Container/Compiler/TaggedServiceIdsIterator/BackwardCompatibleIterator.php
Show resolved
Hide resolved
…on\Compiler\TaggedServiceIdsIterator\BackwardCompatibleIterator
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.
I've verified that both verions of the tags (old and new) are correctly working for LSE, solr and elastic.
One thing that worries me - I can't get the deprecations warning to show up in logs.
Not sure if it's misconfiguration on my side, I've found this comment from @alongosz:
Unfortunately my tests show that @trigger_error doesn't get logged when building Symfony container.
From: ezsystems/ezpublish-kernel#2291 (~2 years ago)
I'm happy to discuss it tomorrow, I've used the prod monolog config: https://github.com/ezsystems/ezplatform/blob/master/config/packages/prod/monolog.yaml which contains a deprecations handler, but I might be missing something in config.
@mnocon Monolog is not available during Container building because Logger is a Container service. Chicken and the egg problem. |
@alongosz you're right! Found them in the mentioned file. Thanks, this can be merged then (together with related PRs). |
v3.x
Tags used to register Search Engine features in the dependency injection container should be consistent and follow Symfony convention (snake case).
Commits between 73ae9f7 - d0ad33f contains refactoring of existing backward compatibility layer for
ezplatform.field_type.*
ezplatform.query_type.*
.Basically duplicated logic of iteration over service ids tagged wtith current and deprecated tag has been extracted to
\eZ\Publish\Core\Base\Container\Compiler\TaggedServiceIdsIterator\BackwardCompatibleIterator
.Commit 76bce15 deprecates
ezpublish.searchEngine
andezpublish.searchEngineIndexer
in favour ofezplatform.search_engine
andezplatform.search_engine.indexer
Checklist:
$ composer fix-cs
).