-
Notifications
You must be signed in to change notification settings - Fork 15
IBX-10458: Implemented new Content Type search PHP API #633
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
Open
barw4
wants to merge
15
commits into
4.6
Choose a base branch
from
ibx-10458-content-type-search-papi
base: 4.6
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2b52ed3
IBX-10458: Implemented new Content Type search PHP API
barw4 e2d3b62
IBX-10458: PHPStan
barw4 a117ddd
IBX-10458: Update
barw4 f2ad9c9
IBX-10458: Refactor
barw4 252733d
IBX-10458: Refactor
barw4 2a75be1
IBX-10458: Refactor
barw4 0b2ec1f
IBX-10458: Fixup
barw4 b56a9da
IBX-10458: Fixup
barw4 6eff1d1
IBX-10458: Fixup
barw4 34869c6
IBX-10458: Applied review remarks
barw4 6204f3e
IBX-10458: Remove `countContentTypes`
barw4 0859ce5
IBX-10458: Fixup
barw4 f81683c
IBX-10458: Fixed count
barw4 09480fa
IBX-10458: Fixed pagination test
barw4 e57e3b8
Merge branch '4.6' into ibx-10458-content-type-search-papi
barw4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/contracts/Persistence/Content/Type/CriterionHandlerInterface.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Persistence\Content\Type; | ||
|
||
use Doctrine\DBAL\Query\QueryBuilder; | ||
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface; | ||
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor; | ||
|
||
/** | ||
* @template TCriterion of \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface | ||
*/ | ||
interface CriterionHandlerInterface | ||
{ | ||
/** | ||
* @param TCriterion $criterion | ||
*/ | ||
public function supports(CriterionInterface $criterion): bool; | ||
|
||
/** | ||
* @param TCriterion $criterion | ||
* | ||
* @return string|\Doctrine\DBAL\Query\Expression\CompositeExpression | ||
*/ | ||
public function apply( | ||
CriterionVisitor $criterionVisitor, | ||
QueryBuilder $qb, | ||
CriterionInterface $criterion | ||
); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/contracts/Repository/Values/ContentType/Query/ContentTypeQuery.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query; | ||
|
||
final class ContentTypeQuery | ||
{ | ||
public const DEFAULT_LIMIT = 25; | ||
|
||
private ?CriterionInterface $criterion; | ||
|
||
/** @var \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause[] */ | ||
private array $sortClauses; | ||
|
||
private int $offset; | ||
|
||
private int $limit; | ||
|
||
/** | ||
* @param \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause[] $sortClauses | ||
*/ | ||
public function __construct( | ||
?CriterionInterface $criterion = null, | ||
array $sortClauses = [], | ||
int $offset = 0, | ||
int $limit = self::DEFAULT_LIMIT | ||
) { | ||
$this->criterion = $criterion; | ||
$this->sortClauses = $sortClauses; | ||
$this->offset = $offset; | ||
$this->limit = $limit; | ||
} | ||
|
||
public function getCriterion(): ?CriterionInterface | ||
{ | ||
return $this->criterion; | ||
} | ||
|
||
public function setCriterion(?CriterionInterface $criterion): void | ||
{ | ||
$this->criterion = $criterion; | ||
} | ||
|
||
public function addSortClause(SortClause $sortClause): void | ||
{ | ||
$this->sortClauses[] = $sortClause; | ||
} | ||
|
||
/** | ||
* @return \Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause[] | ||
*/ | ||
public function getSortClauses(): array | ||
{ | ||
return $this->sortClauses; | ||
} | ||
|
||
public function getOffset(): int | ||
{ | ||
return $this->offset; | ||
} | ||
|
||
public function setOffset(int $offset): void | ||
{ | ||
$this->offset = $offset; | ||
} | ||
|
||
public function getLimit(): int | ||
{ | ||
return $this->limit; | ||
} | ||
|
||
public function setLimit(int $limit): void | ||
{ | ||
$this->limit = $limit; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/contracts/Repository/Values/ContentType/Query/Criterion/ContainsFieldDefinitionId.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface; | ||
|
||
final class ContainsFieldDefinitionId implements CriterionInterface | ||
{ | ||
/** @var list<int>|int */ | ||
private $value; | ||
|
||
/** | ||
* @param list<int>|int $value | ||
*/ | ||
public function __construct($value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return list<int>|int | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @param list<int>|int $value | ||
*/ | ||
public function setValue($value): void | ||
{ | ||
$this->value = $value; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/contracts/Repository/Values/ContentType/Query/Criterion/ContentTypeGroupId.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface; | ||
|
||
final class ContentTypeGroupId implements CriterionInterface | ||
{ | ||
/** @var list<int>|int */ | ||
private $value; | ||
|
||
/** | ||
* @param list<int>|int $value | ||
*/ | ||
public function __construct($value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return list<int>|int | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @param list<int>|int $value | ||
*/ | ||
public function setValue($value): void | ||
{ | ||
$this->value = $value; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/contracts/Repository/Values/ContentType/Query/Criterion/ContentTypeId.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface; | ||
|
||
final class ContentTypeId implements CriterionInterface | ||
{ | ||
/** @var list<int>|int */ | ||
private $value; | ||
|
||
/** | ||
* @param list<int>|int $value | ||
*/ | ||
public function __construct($value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return list<int>|int | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @param list<int>|int $value | ||
*/ | ||
public function setValue($value): void | ||
{ | ||
$this->value = $value; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/contracts/Repository/Values/ContentType/Query/Criterion/ContentTypeIdentifier.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface; | ||
|
||
final class ContentTypeIdentifier implements CriterionInterface | ||
{ | ||
/** @var list<string>|string */ | ||
private $value; | ||
|
||
/** | ||
* @param list<string>|string $value | ||
*/ | ||
public function __construct($value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* @return list<string>|string | ||
*/ | ||
public function getValue() | ||
{ | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @param list<string>|string $value | ||
*/ | ||
public function setValue($value): void | ||
{ | ||
$this->value = $value; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/contracts/Repository/Values/ContentType/Query/Criterion/IsSystem.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion; | ||
|
||
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface; | ||
|
||
final class IsSystem implements CriterionInterface | ||
{ | ||
private bool $value; | ||
|
||
public function __construct(bool $value = true) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public function getValue(): bool | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function setValue(bool $value): void | ||
{ | ||
$this->value = $value; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/contracts/Repository/Values/ContentType/Query/Criterion/LogicalAnd.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion; | ||
|
||
final class LogicalAnd extends LogicalOperator | ||
{ | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
PHPStan types need to be prefixed with
@phpstan-param
instead of@param
. Otherwise, most likely, it will crash phpDocumentor.