-
Notifications
You must be signed in to change notification settings - Fork 203
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-31127: Skipped non-existing Content Types in ContentTypeIdentifier criterion #2872
Conversation
Hi. Will this be going in any time soon? It would be nice if it could make it into the next patch release. |
eZ/Publish/Core/Search/Legacy/Content/Common/Gateway/CriterionHandler/ContentTypeIdentifier.php
Show resolved
Hide resolved
+1, but should ideally have some small integration test coverage for this in terms of legacy SQL vs Solr vs ... |
Any tips on getting started with the test? As far as I can see, this does not have any tests at all. |
ezpublish-kernel/eZ/Publish/API/Repository/Tests/SearchServiceTest.php Lines 132 to 140 in 31bd435
Maybe duplicate this one with a invalid type? And duplicate the MatchNone case below with two invalid types. |
Not sure what you mean about duplicating |
BTW, Solr variant of this PR: ezsystems/ezplatform-solr-search-engine#161 |
Assuming MatchNone fixture is for empty response here, but something like:
|
Ah, okay, I understand now. Updated the test case. |
Failures are probably related to not having the changes from ezsystems/ezplatform-solr-search-engine#161. |
try { | ||
$idList[] = $this->contentTypeHandler->loadByIdentifier($identifier)->id; | ||
} catch (NotFoundException $e) { | ||
// Skip non-existing content types |
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.
Question: wouldn't we actually want to log (warning) usage of non-existing Content Type identifiers? So the Maintainers can trace any outdated apps.
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.
@andrerom mentioned it earlier. Yes, but as a separate improvement, that adds logging consistently to every handler that has the same issues.
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.
For the case where only some are invalid I agree we should add warning directly here, as it's a bit unique case compared to other criteria.
Maybe something like:
// Skip non-existing content types | |
// Skip non-existing content types, but track for code below | |
$invalidIdentifiers[] = $identifier; |
Then further down:
if (count($idList) === 0) {
return $query->expr->not($query->bindValue('1'));
} else (!empty($invalidIdentifiers)) {
// log warning or error
}
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.
Updated in 0ef9b7f
Going in? :) |
In queue for QA. Maybe I'll be able to start today. Aiming to get it in this week. |
@micszo Thanks for the update! 👍 |
@emodric could you please try rebasing both PRs? some tests failed due to missing TranslatedName which was introduced in a fix several days ago. |
@micszo Done! |
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 Approved on eZ Platform EE 2.5 with branches with Legacy SE & Solr.
In case of LSE warning is printed twice but we confirmed it's not related to these changes.
Thanks for support to @alongosz!
@alongosz could you merge it up? |
Thanks all for review! |
… converting content type identifiers to IDs Related issue fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
Fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
…tType() directly Fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
Related issue fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
Fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
Fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
Fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
Fixed in eZ Publish kernel 7.5.7 ezsystems/ezpublish-kernel#2872
7.5
Makes it possible to use non existent content type identifiers in the criterion (e.g. when coming from an outside DB field, where the content type might be deleted in the meantime).
Otherwise, you'd have to use
ContentTypeId
and load the IDs yourself.TODO:
$ composer fix-cs
).