-
Notifications
You must be signed in to change notification settings - Fork 2
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-31745: Introduce PagerSearchDataMapper interface #7
Conversation
Also please rebase it and target it against 3.1 branch. |
@ViniTou |
@ezsystems/php-dev-team |
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.
TL;DR;:
In this case I would suggest an event which will be dispatched inside the mapper to collect required extra parameters and attach them in each iteration or after the mapping, inside Search View Builder, to process an entire $view
.
Review:
First of all, there are some out of scope whitespace changes, which makes it difficult to review. Not sure why you need them, but if you do, place them in a separate commit, please.
As I totally agree with changing typehint for mapper to some abstraction, I now have mixed feelings about placing this interface here, or maybe rather with naming. If you look now, we already have
\EzSystems\EzPlatformAdminUi\Tab\Dashboard\PagerContentToDataMapper
which on first glance should also implement this interface but on other it is completely unrelated to Search.
Since it uses separate namespaces, no strong feelings here. Could be PagerSearchDataMapper
or language-wise more correct - but inconsistent - SearchPagerDataMapper
. Notice that I didn't use Interface suffix here intentionally, because I consider it a bad extension of Hungarian notation and one of the worst practices advocated both by PSR and Symfony, for reasons passing my understanding.
Naming aside, using decoration here is very error prone and breaks a bit responsibility, because decorator would be required to provide all the necessary data items, including the core ones. This will lead to possible BC breaks, when our mapper gets updated with some new required parameters. We cannot give a BC promise on that, otherwise updating wouldn't be possible.
Ok, fix for yaml code style removed.
Agree about naming) updated to "PagerSearchDataMapper".
Sorry, but I didn't find any better way of extending this.
and define class as:
This will work if the core mapper updated with some new parameters. It will break if |
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.
In general 1.0 is no longer supported, rebase to 1.1 and fix other issues please.
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace Ibexa\Platform\Search\Mapper; |
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.
declare(strict_types=1);
@@ -20,7 +20,7 @@ | |||
use eZ\Publish\Core\MVC\Symfony\Locale\UserLanguagePreferenceProviderInterface; | |||
use Pagerfanta\Pagerfanta; | |||
|
|||
class PagerSearchContentToDataMapper | |||
class PagerSearchContentToSearchDataMapper implements PagerSearchDataMapper |
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.
This is a BC break for this package. Any code which relied on PagerSearchContentToDataMapper
is going to stop working. What you could do is to re-add this class in the form of PagerSearchContentToDataMapper extends PagerSearchContentToSearchDataMapper
and annotate it as @deprecated since Ibexa v3.2, use PagerSearchContentToSearchDataMapper instead
Currently, if I want to add some extra information in search result template, I can decorate
"Ibexa\Platform\Search\Mapper\PagerSearchContentToDataMapper" service.
But, decorator service is not accepted by SearchViewBuilder.
Checklist:
$ composer fix-cs
)