Skip to content
Merged
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
2 changes: 1 addition & 1 deletion data/mysql/cleandata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ VALUES (1,9,1,2,3,1448889046,'Ibexa Platform',14,1448889046,'9459d3c29e15006e451
(1,1,50,2,3,1080220220,'Files',14,1080220220,'732a5acd01b51a6fe6eab448ad4138a9',3,1),
(1,1,51,2,3,1080220233,'Multimedia',14,1080220233,'09082deb98662a104f325aaa8c4933d3',3,1);

INSERT INTO `ibexa_content_field` (`attribute_original_id`, `contentclassattribute_id`, `contentobject_id`, `data_float`, `data_int`, `data_text`, `data_type_string`, `id`, `language_code`, `language_id`, `sort_key_int`, `sort_key_string`, `version`)
INSERT INTO `ibexa_content_field` (`attribute_original_id`, `content_type_field_definition_id`, `contentobject_id`, `data_float`, `data_int`, `data_text`, `data_type_string`, `id`, `language_code`, `language_id`, `sort_key_int`, `sort_key_string`, `version`)
VALUES (0,4,1,NULL,NULL,'Ibexa Platform','ibexa_string',1,'eng-GB',3,0,'ibexa platform',9),
(0,119,1,NULL,NULL,'<?xml version="1.0" encoding="UTF-8"?><section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml" xmlns:ezcustom="http://ibexa.co/xmlns/dxp/docbook/custom" version="5.0-variant ezpublish-1.0"><para><emphasis role="strong">You are now ready to start your project.</emphasis></para></section>','ibexa_richtext',2,'eng-GB',3,0,'',9),
(0,7,4,NULL,NULL,'Main group','ibexa_string',7,'eng-GB',3,0,'',1),
Expand Down
2 changes: 1 addition & 1 deletion data/postgresql/cleandata.sql
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ VALUES (1,9,1,2,3,1448889046,'Ibexa Platform',14,1448889046,'9459d3c29e15006e451
(1,1,50,2,3,1080220220,'Files',14,1080220220,'732a5acd01b51a6fe6eab448ad4138a9',3,1),
(1,1,51,2,3,1080220233,'Multimedia',14,1080220233,'09082deb98662a104f325aaa8c4933d3',3,1);

INSERT INTO "ibexa_content_field" ("attribute_original_id", "contentclassattribute_id", "contentobject_id", "data_float", "data_int", "data_text", "data_type_string", "id", "language_code", "language_id", "sort_key_int", "sort_key_string", "version")
INSERT INTO "ibexa_content_field" ("attribute_original_id", "content_type_field_definition_id", "contentobject_id", "data_float", "data_int", "data_text", "data_type_string", "id", "language_code", "language_id", "sort_key_int", "sort_key_string", "version")
VALUES (0,4,1,NULL,NULL,'Ibexa Platform','ibexa_string',1,'eng-GB',3,0,'ibexa platform',9),
(0,119,1,NULL,NULL,E'<?xml version="1.0" encoding="UTF-8"?><section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ezxhtml="http://ibexa.co/xmlns/dxp/docbook/xhtml" xmlns:ezcustom="http://ibexa.co/xmlns/dxp/docbook/custom" version="5.0-variant ezpublish-1.0"><para><emphasis role="strong">You are now ready to start your project.</emphasis></para></section>','ibexa_richtext',2,'eng-GB',3,0,'',9),
(0,7,4,NULL,NULL,'Main group','ibexa_string',7,'eng-GB',3,0,'',1),
Expand Down
2 changes: 1 addition & 1 deletion phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ parameters:
path: src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php

-
message: '#^Method Ibexa\\Bundle\\Core\\Command\\VirtualFieldDuplicateFixCommand\:\:getDuplicatedAttributesBatch\(\) should return array\<array\{version\: int, contentclassattribute_id\: int, contentobject_id\: int, language_id\: int\}\> but returns list\<array\<string, mixed\>\>\.$#'
message: '#^Method Ibexa\\Bundle\\Core\\Command\\VirtualFieldDuplicateFixCommand\:\:getDuplicatedAttributesBatch\(\) should return array\<array\{version\: int, content_type_field_definition_id\: int, contentobject_id\: int, language_id\: int\}\> but returns list\<array\<string, mixed\>\>\.$#'
identifier: return.type
count: 1
path: src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php
Expand Down
12 changes: 6 additions & 6 deletions src/bundle/Core/Command/VirtualFieldDuplicateFixCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private function getDuplicatedAttributeTotalCount(
$stopwatch->start('total_count', 'sql');
$query = $this->connection->createQueryBuilder()
->select('COUNT(a.id) as instances')
->groupBy('version', 'contentclassattribute_id', 'contentobject_id', 'language_id')
->groupBy('version', 'content_type_field_definition_id', 'contentobject_id', 'language_id')
->from(Gateway::CONTENT_FIELD_TABLE, 'a')
->having('instances > 1');

Expand All @@ -184,7 +184,7 @@ private function getDuplicatedAttributeTotalCount(
/**
* @phpstan-return array<array{
* version: int,
* contentclassattribute_id: int,
* content_type_field_definition_id: int,
* contentobject_id: int,
* language_id: int,
* }>
Expand All @@ -194,8 +194,8 @@ private function getDuplicatedAttributesBatch(int $batchSize): array
$query = $this->connection->createQueryBuilder();

$query
->select('version', 'contentclassattribute_id', 'contentobject_id', 'language_id')
->groupBy('version', 'contentclassattribute_id', 'contentobject_id', 'language_id')
->select('version', 'content_type_field_definition_id', 'contentobject_id', 'language_id')
->groupBy('version', 'content_type_field_definition_id', 'contentobject_id', 'language_id')
->from(Gateway::CONTENT_FIELD_TABLE)
->having('COUNT(id) > 1')
->setFirstResult(0)
Expand All @@ -207,7 +207,7 @@ private function getDuplicatedAttributesBatch(int $batchSize): array
/**
* @phpstan-param array{
* version: int,
* contentclassattribute_id: int,
* content_type_field_definition_id: int,
* contentobject_id: int,
* language_id: int
* } $attribute
Expand All @@ -222,7 +222,7 @@ private function getDuplicatedAttributeIds(array $attribute): array
->select('id')
->from(Gateway::CONTENT_FIELD_TABLE)
->andWhere('version = :version')
->andWhere('contentclassattribute_id = :contentclassattribute_id')
->andWhere('content_type_field_definition_id = :content_type_field_definition_id')
->andWhere('contentobject_id = :contentobject_id')
->andWhere('language_id = :language_id')
->orderBy('id', 'ASC')
Expand Down
14 changes: 7 additions & 7 deletions src/bundle/Core/Resources/config/storage/legacy/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ tables:
indexes:
ibexa_content_type_field_definition_ml_lang_fk: { fields: [language_id] }
id:
contentclass_attribute_id: { type: integer, nullable: false }
content_type_field_definition_id: { type: integer, nullable: false }
status: { type: integer, nullable: false }
language_id: { type: bigint, nullable: false }
fields:
Expand Down Expand Up @@ -240,7 +240,7 @@ tables:
ibexa_content_field:
indexes:
ibexa_content_field_co_id_ver_lang_code: { fields: [contentobject_id, version, language_code] }
ibexa_content_field_classattr_id: { fields: [contentclassattribute_id] }
ibexa_content_field_field_definition_id: { fields: [content_type_field_definition_id] }
sort_key_string: { fields: [sort_key_string], options: { lengths: ['191'] } }
ibexa_content_field_language_code: { fields: [language_code] }
sort_key_int: { fields: [sort_key_int] }
Expand All @@ -250,7 +250,7 @@ tables:
version: { type: integer, nullable: false, options: { default: '0' } }
fields:
attribute_original_id: { type: integer, nullable: true, options: { default: '0' } }
contentclassattribute_id: { type: integer, nullable: false, options: { default: '0' } }
content_type_field_definition_id: { type: integer, nullable: false, options: { default: '0' } }
contentobject_id: { type: integer, nullable: false, options: { default: '0' } }
data_float: { type: float, nullable: true, length: 0 }
data_int: { type: integer, nullable: true }
Expand All @@ -263,12 +263,12 @@ tables:
ibexa_content_relation:
indexes:
ibexa_content_relation_to_co_id: { fields: [to_contentobject_id] }
ibexa_content_relation_from: { fields: [from_contentobject_id, from_contentobject_version, contentclassattribute_id] }
ibexa_content_relation_cca_id: { fields: [ contentclassattribute_id ] }
ibexa_content_relation_from: { fields: [from_contentobject_id, from_contentobject_version, content_type_field_definition_id] }
ibexa_content_relation_ccfd_id: { fields: [ content_type_field_definition_id ] }
id:
id: { type: integer, nullable: false, options: { autoincrement: true } }
fields:
contentclassattribute_id: { type: integer, nullable: false, options: { default: '0' } }
content_type_field_definition_id: { type: integer, nullable: false, options: { default: '0' } }
from_contentobject_id: { type: integer, nullable: false, options: { default: '0' } }
from_contentobject_version: { type: integer, nullable: false, options: { default: '0' } }
relation_type: { type: integer, nullable: false, options: { default: '1' } }
Expand Down Expand Up @@ -498,7 +498,7 @@ tables:
id:
id: { type: integer, nullable: false, options: { autoincrement: true } }
fields:
contentclass_attribute_id: { type: integer, nullable: false, options: { default: '0' } }
content_type_field_definition_id: { type: integer, nullable: false, options: { default: '0' } }
content_type_id: { type: integer, nullable: false, options: { default: '0' } }
contentobject_id: { type: integer, nullable: false, options: { default: '0' } }
frequency: { type: float, nullable: false, length: 0, options: { default: '0' } }
Expand Down
16 changes: 8 additions & 8 deletions src/lib/Persistence/Legacy/Content/Gateway/DoctrineDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ private function setInsertFieldValues(
->values(
[
'contentobject_id' => ':content_id',
'contentclassattribute_id' => ':field_definition_id',
'content_type_field_definition_id' => ':field_definition_id',
'data_type_string' => ':data_type_string',
'language_code' => ':language_code',
'version' => ':version_no',
Expand Down Expand Up @@ -660,7 +660,7 @@ public function updateNonTranslatableField(
$query = $this->connection->createQueryBuilder();
$this->setFieldUpdateValues($query, $value);
$query
->where('contentclassattribute_id = :field_definition_id')
->where('content_type_field_definition_id = :field_definition_id')
->andWhere('contentobject_id = :content_id')
->andWhere('version = :version_no')
->setParameter('field_definition_id', $field->fieldDefinitionId, ParameterType::INTEGER)
Expand Down Expand Up @@ -719,7 +719,7 @@ private function internalLoadContent(
'v.language_mask AS content_version_language_mask',
'v.initial_language_id AS content_version_initial_language_id',
'a.id AS content_field_id',
'a.contentclassattribute_id AS content_field_contentclassattribute_id',
'a.content_type_field_definition_id AS content_field_content_type_field_definition_id',
'a.data_type_string AS content_field_data_type_string',
'a.language_code AS content_field_language_code',
'a.language_id AS content_field_language_id',
Expand Down Expand Up @@ -1129,7 +1129,7 @@ public function removeReverseFieldRelations(int $contentId): void
$expr->and(
'l.from_contentobject_id = a.contentobject_id',
'l.from_contentobject_version = a.version',
'l.contentclassattribute_id = a.contentclassattribute_id'
'l.content_type_field_definition_id = a.content_type_field_definition_id'
)
)
->where('l.to_contentobject_id = :content_id')
Expand Down Expand Up @@ -1166,7 +1166,7 @@ public function removeRelationsByFieldDefinitionId(int $fieldDefinitionId): void
{
$query = $this->connection->createQueryBuilder();
$query->delete(self::CONTENT_RELATION_TABLE)
->where('contentclassattribute_id = :field_definition_id')
->where('content_type_field_definition_id = :field_definition_id')
->setParameter('field_definition_id', $fieldDefinitionId, ParameterType::INTEGER);

$query->executeStatement();
Expand Down Expand Up @@ -1645,7 +1645,7 @@ public function insertRelation(RelationCreateStruct $createStruct): int
->insert(self::CONTENT_RELATION_TABLE)
->values(
[
'contentclassattribute_id' => ':field_definition_id',
'content_type_field_definition_id' => ':field_definition_id',
'from_contentobject_id' => ':from_content_id',
'from_contentobject_version' => ':from_version_no',
'relation_type' => ':relation_type',
Expand Down Expand Up @@ -1810,7 +1810,7 @@ public function copyRelations(
$selectQuery = $this->connection->createQueryBuilder();
$selectQuery
->select(
'l.contentclassattribute_id',
'l.content_type_field_definition_id',
':copied_id',
'l.from_contentobject_version',
'l.relation_type',
Expand All @@ -1830,7 +1830,7 @@ public function copyRelations(
$contentLinkTable = Gateway::CONTENT_RELATION_TABLE;
$insertQuery = <<<SQL
INSERT INTO $contentLinkTable (
contentclassattribute_id,
content_type_field_definition_id,
from_contentobject_id,
from_contentobject_version,
relation_type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function createRelationFindQueryBuilder(): DoctrineQueryBuilder
$query
->select(
'l.id AS content_link_id',
'l.contentclassattribute_id AS content_link_contentclassattribute_id',
'l.content_type_field_definition_id AS content_link_content_type_field_definition_id',
'l.from_contentobject_id AS content_link_from_contentobject_id',
'l.from_contentobject_version AS content_link_from_contentobject_version',
'l.relation_type AS content_link_relation_type',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Persistence/Legacy/Content/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public function createDraftFromVersion($contentId, $srcVersion, $userId, ?string
[
'sourceContentId' => $contentId,
'sourceContentVersionNo' => $content->versionInfo->versionNo,
'sourceFieldDefinitionId' => $relation['content_link_contentclassattribute_id'],
'sourceFieldDefinitionId' => $relation['content_link_content_type_field_definition_id'],
'destinationContentId' => $relation['content_link_to_contentobject_id'],
'type' => (int)$relation['content_link_relation_type'],
]
Expand Down
6 changes: 3 additions & 3 deletions src/lib/Persistence/Legacy/Content/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public function extractContentFromRows(
}

$fieldId = (int)$row["{$prefix}field_id"];
$fieldDefinitionId = (int)$row["{$prefix}field_contentclassattribute_id"];
$fieldDefinitionId = (int)$row["{$prefix}field_content_type_field_definition_id"];
$languageCode = $row["{$prefix}field_language_code"];

if (!isset($fields[$contentId][$versionId][$fieldId])
Expand Down Expand Up @@ -578,7 +578,7 @@ protected function extractFieldFromRow(array $row): Field
$field = new Field();

$field->id = (int)$row['content_field_id'];
$field->fieldDefinitionId = (int)$row['content_field_contentclassattribute_id'];
$field->fieldDefinitionId = (int)$row['content_field_content_type_field_definition_id'];

$fieldTypeString = $row['content_field_data_type_string'];
$fieldTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($fieldTypeString);
Expand Down Expand Up @@ -693,7 +693,7 @@ public function extractRelationFromRow(array $row)
$relation->destinationContentId = (int)$row['content_link_to_contentobject_id'];
$relation->type = (int)$row['content_link_relation_type'];

$contentClassAttributeId = (int)$row['content_link_contentclassattribute_id'];
$contentClassAttributeId = (int)$row['content_link_content_type_field_definition_id'];
if ($contentClassAttributeId > 0) {
$relation->sourceFieldDefinitionId = $contentClassAttributeId;
}
Expand Down
Loading
Loading