-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support for getting the results for a location #38
Conversation
b86885e
to
abd1f4f
Compare
de9c945
to
efc0146
Compare
d7f318f
to
cb336e4
Compare
cb336e4
to
a236233
Compare
$items = $this->queryFieldService->loadContentItemsSlice($content, $fieldDefinitionIdentifier, $offset, $limit); | ||
$location = null; | ||
$content = $this->contentService->loadContent($contentId, null, $versionNumber); | ||
if ($limit === -1 || !method_exists($this->queryFieldService, 'loadContentItemsSlice')) { |
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.
if ($limit === -1 || !method_exists($this->queryFieldService, 'loadContentItemsSlice')) { | |
if ($limit === -1) { |
It's guaranteed that loadContentItemsSlicea
exists as you expect an \EzSystems\EzPlatformQueryFieldType\API\QueryFieldService
(final class) as QueryFieldRestController
construct arg.
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.
Well, indeed (it was a backward compatibility check when pagination was introduced).
But that change is not part of that pull-request, it is just moved around :)
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 done fixing your comments. I'll push the code tomorrow morning, as I worked on the v3 sub-branch for the feature... :)
$items = $this->queryFieldService->loadContentItemsSlice($content, $fieldDefinitionIdentifier, $offset, $limit); | ||
$location = null; | ||
$content = $this->contentService->loadContent($contentId, null, $versionNumber); | ||
if ($limit === -1 || !method_exists($this->queryFieldService, 'loadContentItemsSlice')) { |
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.
Well, indeed (it was a backward compatibility check when pagination was introduced).
But that change is not part of that pull-request, it is just moved around :)
I think that's it, as long as Travis agrees. |
Ping @ezsystems/php-dev-team. |
c194b75
to
7e0aa71
Compare
All review comments have been fixed, can we move on with this ? |
7e0aa71
to
1482904
Compare
All fixed @Steveb-p (rebased into the correct commits). |
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.
Apart from one minor comment, LGTM ;)
/** | ||
* Returns the query results for the given location. | ||
*/ | ||
public function loadContentItemsForLocation(Location $location, string $fieldDefinitionIdentifier): iterable; | ||
|
||
/** | ||
* Returns a slice of the query results for the given location. | ||
*/ | ||
public function loadContentItemsSliceForLocation(Location $location, string $fieldDefinitionIdentifier, int $offset, int $limit): iterable; |
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 those methods receive @return
notes? I've seen them in concrete implementation, and I think they're even more important to be added 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.
Done.
…ation with REST An extra 'location' query parameter can be provided with a location href. If provided, that particular location will be used instead of the main one.
1482904
to
9bcdc32
Compare
Updated again, and CS warning fixed. |
v2.x
,v3.x
Introduces a new
QueryFieldLocationService
that allow to get results / results slices / count results based on a location. With the previous methods, onlymainLocation
was available as a variable, since it was inferred from the content.Now both can be available, and
location
will be set to the "current" location. In the context of a content view, it will be the requested location's. For REST and GraphQL, parameters will be added to specify which location should be used.TODO
PagerFantaAdapter
QueryResultsInjector
Checklist
$ composer fix-cs
).