Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 103 additions & 7 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -20778,6 +20778,54 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\ContainsFieldDefinitionId implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/ContainsFieldDefinitionId.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\ContentTypeGroupId implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/ContentTypeGroupId.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\ContentTypeId implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/ContentTypeId.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\ContentTypeIdentifier implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/ContentTypeIdentifier.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\IsSystem implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/IsSystem.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\LogicalAnd implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/LogicalAnd.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\LogicalNot implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/LogicalNot.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Gateway\\CriterionHandler\\LogicalOr implements generic interface Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\CriterionHandlerInterface but does not specify its types\: TCriterion$#'
identifier: missingType.generics
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Gateway/CriterionHandler/LogicalOr.php

-
message: '#^Cannot call method fetchAll\(\) on Doctrine\\DBAL\\ForwardCompatibility\\Result\|int\|string\.$#'
identifier: method.nonObject
Expand Down Expand Up @@ -20865,7 +20913,7 @@ parameters:
-
message: '#^Parameter \#4 \$condition of method Doctrine\\DBAL\\Query\\QueryBuilder\:\:leftJoin\(\) expects string\|null, Doctrine\\DBAL\\Query\\Expression\\CompositeExpression given\.$#'
identifier: argument.type
count: 5
count: 7
path: src/lib/Persistence/Legacy/Content/Type/Gateway/DoctrineDatabase.php

-
Expand Down Expand Up @@ -21036,6 +21084,12 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Handler.php

-
message: '#^Parameter \#1 \$rows of method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper\:\:extractTypesFromRowsWithRelationProxies\(\) expects array\{items\: array\<int, array\<string, mixed\>\>, count\: int\}, array\<int, array\<string, mixed\>\> given\.$#'
identifier: argument.type
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Handler.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper\:\:extractFieldFromRow\(\) has parameter \$multilingualData with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -21108,6 +21162,12 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper\:\:extractTypesFromRowsWithRelationProxies\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper\:\:toFieldDefinition\(\) has no return type specified\.$#'
identifier: missingType.return
Expand All @@ -21120,6 +21180,18 @@ parameters:
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Parameter \#1 \$row of method Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper\:\:extractTypeFromRow\(\) expects array, array\<int, array\<string, mixed\>\>\|int given\.$#'
identifier: argument.type
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Property Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\:\:\$fieldDefinitions \(array\<Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\FieldDefinition\>\) does not accept array\<Ibexa\\Contracts\\Core\\Persistence\\Content\\Type\\FieldDefinition\|Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinition\>\.$#'
identifier: assign.propertyType
count: 1
path: src/lib/Persistence/Legacy/Content/Type/Mapper.php

-
message: '#^Property Ibexa\\Core\\Persistence\\Legacy\\Content\\MultilingualStorageFieldDefinition\:\:\$description \(string\) does not accept string\|null\.$#'
identifier: assign.propertyType
Expand Down Expand Up @@ -24996,6 +25068,12 @@ parameters:
count: 1
path: src/lib/Repository/ProxyFactory/ProxyDomainMapper.php

-
message: '#^Method Ibexa\\Core\\Repository\\ProxyFactory\\ProxyDomainMapper\:\:createFieldDefinitionProxy\(\) has parameter \$prioritizedLanguages with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Repository/ProxyFactory/ProxyDomainMapper.php

-
message: '#^Method Ibexa\\Core\\Repository\\ProxyFactory\\ProxyDomainMapper\:\:createLanguageProxyList\(\) has parameter \$languageCodes with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -25032,6 +25110,12 @@ parameters:
count: 1
path: src/lib/Repository/ProxyFactory/ProxyDomainMapper.php

-
message: '#^Parameter \#2 \$initializer of method ProxyManager\\Factory\\LazyLoadingValueHolderFactory\:\:createProxy\(\) expects Closure\(Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinition\|null\=, Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinition&ProxyManager\\Proxy\\ValueHolderInterface\<Ibexa\\Contracts\\Core\\Repository\\Values\\ContentType\\FieldDefinition\>&ProxyManager\\Proxy\\VirtualProxyInterface\=, string\=, array\<string, mixed\>\=, Closure\|null\=\)\: bool, Closure\(mixed, ProxyManager\\Proxy\\LazyLoadingInterface, mixed, array, mixed\)\: true given\.$#'
identifier: argument.type
count: 1
path: src/lib/Repository/ProxyFactory/ProxyDomainMapper.php

-
message: '#^Parameter \#2 \$initializer of method ProxyManager\\Factory\\LazyLoadingValueHolderFactory\:\:createProxy\(\) expects Closure\(Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\ContentInfo\|null\=, Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\ContentInfo&ProxyManager\\Proxy\\ValueHolderInterface\<Ibexa\\Contracts\\Core\\Repository\\Values\\Content\\ContentInfo\>&ProxyManager\\Proxy\\VirtualProxyInterface\=, string\=, array\<string, mixed\>\=, Closure\|null\=\)\: bool, Closure\(mixed, ProxyManager\\Proxy\\LazyLoadingInterface, mixed, array, mixed\)\: true given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -25110,6 +25194,12 @@ parameters:
count: 1
path: src/lib/Repository/ProxyFactory/ProxyDomainMapperInterface.php

-
message: '#^Method Ibexa\\Core\\Repository\\ProxyFactory\\ProxyDomainMapperInterface\:\:createFieldDefinitionProxy\(\) has parameter \$prioritizedLanguages with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
count: 1
path: src/lib/Repository/ProxyFactory/ProxyDomainMapperInterface.php

-
message: '#^Method Ibexa\\Core\\Repository\\ProxyFactory\\ProxyDomainMapperInterface\:\:createLanguageProxyList\(\) has parameter \$languageCodes with no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -41334,12 +41424,6 @@ parameters:
count: 1
path: tests/integration/Core/Repository/LanguageServiceAuthorizationTest.php

-
message: '#^Comparison operation "\<" between int\<70400, 80599\> and 50400 is always false\.$#'
identifier: smaller.alwaysFalse
count: 1
path: tests/integration/Core/Repository/LanguageServiceMaximumSupportedLanguagesTest.php

-
message: '#^Method Ibexa\\Tests\\Integration\\Core\\Repository\\LanguageServiceMaximumSupportedLanguagesTest\:\:testCreateMaximumLanguageLimit\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down Expand Up @@ -65202,6 +65286,12 @@ parameters:
count: 2
path: tests/lib/Persistence/Legacy/Content/Type/MapperTest.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper constructor invoked with 3 parameters, 4 required\.$#'
identifier: arguments.count
count: 7
path: tests/lib/Persistence/Legacy/Content/Type/MapperTest.php

-
message: '#^Method Ibexa\\Tests\\Core\\Persistence\\Legacy\\Content\\Type\\MapperTest\:\:getLoadGroupFixture\(\) return type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -75024,6 +75114,12 @@ parameters:
count: 1
path: tests/lib/Search/FieldNameResolverTest.php

-
message: '#^Class Ibexa\\Core\\Persistence\\Legacy\\Content\\Type\\Mapper constructor invoked with 3 parameters, 4 required\.$#'
identifier: arguments.count
count: 1
path: tests/lib/Search/Legacy/Content/AbstractTestCase.php

-
message: '#^Method Ibexa\\Tests\\Core\\Search\\Legacy\\Content\\AbstractTestCase\:\:assertSearchResults\(\) has no return type specified\.$#'
identifier: missingType.return
Expand Down
7 changes: 7 additions & 0 deletions src/contracts/Repository/ContentTypeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,13 @@ public function assignContentTypeGroup(ContentType $contentType, ContentTypeGrou
*/
public function unassignContentTypeGroup(ContentType $contentType, ContentTypeGroup $contentTypeGroup): void;

/**
* @param string[] $prioritizedLanguages Used as prioritized language code on translated properties of returned object.
*
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException If field definition with the given id and status DEFINED cannot be found
*/
public function loadFieldDefinition(int $fieldDefinitionId, array $prioritizedLanguages): FieldDefinition;

/**
* Adds a new field definition to an existing content type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ public function unassignContentTypeGroup(
$this->innerService->unassignContentTypeGroup($contentType, $contentTypeGroup);
}

public function loadFieldDefinition(int $fieldDefinitionId, array $prioritizedLanguages): FieldDefinition
{
return $this->innerService->loadFieldDefinition($fieldDefinitionId, $prioritizedLanguages);
}

public function addFieldDefinition(
ContentTypeDraft $contentTypeDraft,
FieldDefinitionCreateStruct $fieldDefinitionCreateStruct
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Persistence\Content\Type\CriterionHandlerInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion\ContainsFieldDefinitionId as ContainsFieldDefinitionIdCriterion;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
use Ibexa\Core\Repository\Values\ContentType\Query\Base;

final class ContainsFieldDefinitionId extends Base
final class ContainsFieldDefinitionId implements CriterionHandlerInterface
{
public function supports(CriterionInterface $criterion): bool
{
Expand All @@ -31,19 +31,23 @@ public function apply(
QueryBuilder $qb,
CriterionInterface $criterion
): string {
$this->joinFieldDefinitions($qb);
$subQuery = $qb->getConnection()->createQueryBuilder();

$value = $criterion->getValue();
if (is_array($value)) {
return $qb->expr()->in(
'a.id',
$whereClause = is_array($criterion->getValue())
? $subQuery->expr()->in(
'f_def.id',
$qb->createNamedParameter($criterion->getValue(), Connection::PARAM_INT_ARRAY)
) : $subQuery->expr()->eq(
'f_def.id',
$qb->createNamedParameter($criterion->getValue(), ParameterType::INTEGER)
);
}

return $qb->expr()->eq(
'a.id',
$qb->createNamedParameter($criterion->getValue(), ParameterType::INTEGER)
);
$subQuery
->select('f_def.contentclass_id')
->from('ezcontentclass_attribute', 'f_def')
->where($whereClause)
->andWhere('f_def.contentclass_id = c.id');

return sprintf('EXISTS (%s)', $subQuery->getSQL());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Persistence\Content\Type\CriterionHandlerInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion\ContentTypeGroupId as ContentTypeGroupIdCriterion;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
use Ibexa\Core\Repository\Values\ContentType\Query\Base;

final class ContentTypeGroupId extends Base
final class ContentTypeGroupId implements CriterionHandlerInterface
{
public function supports(CriterionInterface $criterion): bool
{
Expand All @@ -31,19 +31,22 @@ public function apply(
QueryBuilder $qb,
CriterionInterface $criterion
): string {
$this->joinContentTypeGroupAssignmentTable($qb);

$value = $criterion->getValue();
if (is_array($value)) {
return $qb->expr()->in(
'g.group_id',
$subQuery = $qb->getConnection()->createQueryBuilder();
$whereClause = is_array($criterion->getValue())
? $subQuery->expr()->in(
'c_group.group_id',
$qb->createNamedParameter($criterion->getValue(), Connection::PARAM_INT_ARRAY)
) : $subQuery->expr()->eq(
'c_group.group_id',
$qb->createNamedParameter($criterion->getValue(), ParameterType::INTEGER)
);
}

return $qb->expr()->eq(
'g.group_id',
$qb->createNamedParameter($criterion->getValue(), ParameterType::INTEGER)
);
$subQuery
->select('c_group.contentclass_id')
->from('ezcontentclass_classgroup', 'c_group')
->andWhere($whereClause)
->andWhere('c_group.contentclass_id = c.id');

return sprintf('EXISTS (%s)', $subQuery->getSQL());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Persistence\Content\Type\CriterionHandlerInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion\ContentTypeId as ContentTypeIdCriterion;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
use Ibexa\Core\Repository\Values\ContentType\Query\Base;

final class ContentTypeId extends Base
final class ContentTypeId implements CriterionHandlerInterface
{
public function supports(CriterionInterface $criterion): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Persistence\Content\Type\CriterionHandlerInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion\ContentTypeIdentifier as ContentTypeIdentifierCriterion;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
use Ibexa\Core\Repository\Values\ContentType\Query\Base;

final class ContentTypeIdentifier extends Base
final class ContentTypeIdentifier implements CriterionHandlerInterface
{
public function supports(CriterionInterface $criterion): bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Persistence\Content\Type\CriterionHandlerInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion\IsSystem as IsSystemCriterion;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
use Ibexa\Core\Repository\Values\ContentType\Query\Base;

final class IsSystem extends Base
final class IsSystem implements CriterionHandlerInterface
{
public function supports(CriterionInterface $criterion): bool
{
Expand All @@ -30,12 +30,17 @@ public function apply(
QueryBuilder $qb,
CriterionInterface $criterion
): string {
$this->joinContentTypeGroupAssignmentTable($qb);
$this->joinContentTypeGroup($qb);
$subQuery = $qb->getConnection()->createQueryBuilder();
$subQuery
->select('g.contentclass_id')
->from('ezcontentclassgroup', 'ctg')
->leftJoin('ctg', 'ezcontentclass_classgroup', 'c_group', 'ctg.id = c_group.group_id')
->andWhere($subQuery->expr()->eq(
'ctg.is_system',
$qb->createNamedParameter($criterion->getValue(), ParameterType::BOOLEAN)
))
->andWhere('c_group.contentclass_id = c.id');

return $qb->expr()->eq(
'ctg.is_system',
$qb->createNamedParameter($criterion->getValue(), ParameterType::BOOLEAN)
);
return sprintf('EXISTS (%s)', $subQuery->getSQL());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

use Doctrine\DBAL\Query\Expression\CompositeExpression;
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\Core\Persistence\Content\Type\CriterionHandlerInterface;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion\LogicalAnd as LogicalAndCriterion;
use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\CriterionInterface;
use Ibexa\Core\Persistence\Legacy\Content\Type\Gateway\CriterionVisitor\CriterionVisitor;
use Ibexa\Core\Repository\Values\ContentType\Query\Base;

final class LogicalAnd extends Base
final class LogicalAnd implements CriterionHandlerInterface
{
public function supports(CriterionInterface $criterion): bool
{
Expand Down
Loading
Loading