Skip to content

Commit b62a943

Browse files
committed
Upgraded Content Type Doctrine Gateway to doctrine/dbal v3 and improved code quality
1 parent 1f1bf90 commit b62a943

File tree

3 files changed

+235
-108
lines changed

3 files changed

+235
-108
lines changed

src/lib/Persistence/Legacy/Content/Type/Gateway.php

+37-9
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
*/
2222
abstract class Gateway
2323
{
24-
public const CONTENT_TYPE_TO_GROUP_ASSIGNMENT_TABLE = 'ezcontentclass_classgroup';
25-
public const CONTENT_TYPE_GROUP_TABLE = 'ezcontentclassgroup';
26-
public const CONTENT_TYPE_TABLE = 'ezcontentclass';
27-
public const CONTENT_TYPE_NAME_TABLE = 'ezcontentclass_name';
28-
public const FIELD_DEFINITION_TABLE = 'ezcontentclass_attribute';
29-
public const MULTILINGUAL_FIELD_DEFINITION_TABLE = 'ezcontentclass_attribute_ml';
24+
public const string CONTENT_TYPE_TO_GROUP_ASSIGNMENT_TABLE = 'ezcontentclass_classgroup';
25+
public const string CONTENT_TYPE_GROUP_TABLE = 'ezcontentclassgroup';
26+
public const string CONTENT_TYPE_TABLE = 'ezcontentclass';
27+
public const string CONTENT_TYPE_NAME_TABLE = 'ezcontentclass_name';
28+
public const string FIELD_DEFINITION_TABLE = 'ezcontentclass_attribute';
29+
public const string MULTILINGUAL_FIELD_DEFINITION_TABLE = 'ezcontentclass_attribute_ml';
3030

31-
public const CONTENT_TYPE_GROUP_SEQ = 'ezcontentclassgroup_id_seq';
32-
public const CONTENT_TYPE_SEQ = 'ezcontentclass_id_seq';
33-
public const FIELD_DEFINITION_SEQ = 'ezcontentclass_attribute_id_seq';
31+
public const string CONTENT_TYPE_GROUP_SEQ = 'ezcontentclassgroup_id_seq';
32+
public const string CONTENT_TYPE_SEQ = 'ezcontentclass_id_seq';
33+
public const string FIELD_DEFINITION_SEQ = 'ezcontentclass_attribute_id_seq';
3434

3535
abstract public function insertGroup(Group $group): int;
3636

@@ -44,15 +44,25 @@ abstract public function deleteGroup(int $groupId): void;
4444

4545
/**
4646
* @param int[] $groupIds
47+
*
48+
* @phpstan-return list<array<string,mixed>>
4749
*/
4850
abstract public function loadGroupData(array $groupIds): array;
4951

52+
/**
53+
* @phpstan-return list<array<string,mixed>>
54+
*/
5055
abstract public function loadGroupDataByIdentifier(string $identifier): array;
5156

57+
/**
58+
* @phpstan-return list<array<string,mixed>>
59+
*/
5260
abstract public function loadAllGroupsData(): array;
5361

5462
/**
5563
* Load data for all content types of the given status, belonging to the given Group.
64+
*
65+
* @phpstan-return list<array<string,mixed>>
5666
*/
5767
abstract public function loadTypesDataForGroup(int $groupId, int $status): array;
5868

@@ -76,6 +86,8 @@ abstract public function deleteGroupAssignment(int $groupId, int $typeId, int $s
7686
/**
7787
* @param int $id Field Definition ID
7888
* @param int $status One of Type::STATUS_DEFINED|Type::STATUS_DRAFT|Type::STATUS_MODIFIED
89+
*
90+
* @phpstan-return list<array<string,mixed>>
7991
*/
8092
abstract public function loadFieldDefinition(int $id, int $status): array;
8193

@@ -113,18 +125,31 @@ abstract public function updateType(int $typeId, int $status, Type $type): void;
113125
* Bulk-load an array with data about the given content types.
114126
*
115127
* @param int[] $typeIds
128+
*
129+
* @phpstan-return list<array<string,mixed>>
116130
*/
117131
abstract public function loadTypesListData(array $typeIds): array;
118132

119133
/**
120134
* @return array<mixed>
135+
*
136+
* @phpstan-return list<array<string,mixed>>
121137
*/
122138
abstract public function loadTypesDataByFieldDefinitionIdentifier(string $identifier): array;
123139

140+
/**
141+
* @phpstan-return list<array<string,mixed>>
142+
*/
124143
abstract public function loadTypeData(int $typeId, int $status): array;
125144

145+
/**
146+
* @phpstan-return list<array<string,mixed>>
147+
*/
126148
abstract public function loadTypeDataByIdentifier(string $identifier, int $status): array;
127149

150+
/**
151+
* @phpstan-return list<array<string,mixed>>
152+
*/
128153
abstract public function loadTypeDataByRemoteId(string $remoteId, int $status): array;
129154

130155
abstract public function countInstancesOfType(int $typeId): int;
@@ -154,6 +179,9 @@ abstract public function publishTypeAndFields(
154179
int $targetStatus
155180
): void;
156181

182+
/**
183+
* @phpstan-return list<array<string,mixed>>
184+
*/
157185
abstract public function getSearchableFieldMapData(): array;
158186

159187
/**

0 commit comments

Comments
 (0)