-
Notifications
You must be signed in to change notification settings - Fork 14
IBX-9947: Rebranded field type identifiers #543
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
Conversation
7196c19
to
b75af48
Compare
src/bundle/Core/Resources/views/fielddefinition_settings.html.twig
Outdated
Show resolved
Hide resolved
8b6b2ea
to
91bce77
Compare
], | ||
); | ||
} | ||
|
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.
All ez*
fieldtypes were additionally tagged with legacy_alias
tag, i.e.:
Ibexa\Core\FieldType\Checkbox\Type:
class: Ibexa\Core\FieldType\Checkbox\Type
parent: Ibexa\Core\FieldType\FieldType
tags:
- {name: ibexa.field_type, alias: ibexa_boolean, legacy_alias: ezboolean}
And therefore, these aliases were added to a new registry FieldTypeAliasRegistry
.
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.
Can we mark this part as deprecated for our own purposes when dropping support in 6.0? (if it is planned of course - @adamwojs )
|
||
public function getNewAlias(string $oldAlias): string | ||
{ | ||
return $this->aliasMap[$oldAlias]; |
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.
The registry allows to get a new alias instead of an old legacy alias.
$dataTypeString = $row['content_type_field_definition_data_type_string']; | ||
$dataTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($dataTypeString); |
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.
The whole magic happens here. We are changing identifiers during runtime, maybe we won't need to migrate any existing identifiers stored in database 🤔 but I'm not sure if this is what we want to go with
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 am all for making db migration and droping this in 6.0. @adamwojs
], | ||
); | ||
} | ||
|
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.
Can we mark this part as deprecated for our own purposes when dropping support in 6.0? (if it is planned of course - @adamwojs )
* @return \Ibexa\Contracts\Core\FieldType\FieldType | ||
*/ | ||
public function getFieldType($identifier): SPIFieldType | ||
public function getFieldType(string $identifier): SPIFieldType |
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 this be a good place to check if using old name and if - emit deprecation message?
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 also wonder shouldnt we use decorator pattern here.
@@ -32,7 +32,9 @@ public function toStorageValue(FieldValue $value, StorageFieldValue $storageFiel | |||
{ | |||
// @todo: One should additionally store the timezone here. This could | |||
// be done in a backwards compatible way, I think… | |||
$storageFieldValue->dataInt = ($value->data !== null ? $value->data['timestamp'] : null); | |||
$storageFieldValue->dataInt = ($value->data !== null | |||
? ($value->data['timestamp'] ?? $value->data['timestring']) |
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.
prolly I am missing something, but from what timestring
is coming from?
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.
Discussed on Slack but leaving a note here so that it won't get lost. On 5.0 we are getting:
Warning: Undefined array key "timestamp"
without this change
@@ -1148,15 +1148,15 @@ public function removeReverseFieldRelations(int $contentId): void | |||
$statement = $query->executeQuery(); | |||
|
|||
while ($row = $statement->fetch(FetchMode::ASSOCIATIVE)) { | |||
if ($row['data_type_string'] === 'ezobjectrelation') { | |||
if ($row['data_type_string'] === 'ibexa_object_relation') { |
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 know this is a strech now - but maybe, we can finally introduce const for every FieldType or make getFieldTypeIdentifier
static method? Those strings are really troublesome when spiled accros product.
$dataTypeString = $row['content_type_field_definition_data_type_string']; | ||
$dataTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($dataTypeString); |
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 am all for making db migration and droping this in 6.0. @adamwojs
src/lib/Repository/UserService.php
Outdated
@@ -62,7 +62,7 @@ | |||
*/ | |||
class UserService implements UserServiceInterface | |||
{ | |||
private const USER_FIELD_TYPE_NAME = 'ezuser'; | |||
private const USER_FIELD_TYPE_NAME = 'ibexa_user'; //TODO co z tym? :/ |
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.
as above, in my opinien we should remove this and unify accessing FT types.
0d68129
to
448692b
Compare
$fieldTypeString = $row['content_field_data_type_string']; | ||
$fieldTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($fieldTypeString); | ||
|
||
$field->type = $fieldTypeString; |
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.
and here
4885801
to
65c37af
Compare
|
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 you please add aliases for all renamed services and parameters ? This will help us to keep BC (in a follow up PR).
Related PRs:
ibexa/content-forms#89
ibexa/admin-ui#1560
https://github.com/ibexa/form-builder/pull/182 -
ezform
->ibexa_form
https://github.com/ibexa/fieldtype-page/pull/169 -
ezlandingpage
->ibexa_landing_page
ibexa/user#105 -
ezuser
->ibexa_user
ibexa/fieldtype-matrix#70 ->
ezmatrix
->ibexa_matrix
ibexa/fieldtype-query#41 ->
ezcontentquery
->ibexa_content_query
ibexa/fieldtype-richtext#238 ->
ezrichtext
->ibexa_richtext
https://github.com/ibexa/connector-qualifio/pull/44 ->
ezrichtext
->ibexa_richtext
(only references)https://github.com/ibexa/connector-ai/pull/133 ->
ezrichtext
->ibexa_richtext
(only references)ibexa/rest#173 ->
ezimageasset
->ibexa_image_asset
(only references)ibexa/graphql#87
https://github.com/ibexa/image-editor/pull/114
https://github.com/ibexa/version-comparison/pull/102
https://github.com/ibexa/connector-dam/pull/82
https://github.com/ibexa/product-catalog/pull/1334
https://github.com/ibexa/taxonomy/pull/351
https://github.com/ibexa/cart/pull/142
https://github.com/ibexa/checkout/pull/221
https://github.com/ibexa/corporate-account/pull/299
https://github.com/ibexa/page-builder/pull/444
https://github.com/ibexa/installer/pull/174
https://github.com/ibexa/image-picker/pull/115
https://github.com/ibexa/product-catalog-date-time-attribute/pull/37
https://github.com/ibexa/storefront/pull/223
https://github.com/ibexa/order-management/pull/161
https://github.com/ibexa/personalization/pull/378
https://github.com/ibexa/measurement/pull/116
https://github.com/ibexa/discounts/pull/257
https://github.com/ibexa/connector-openai/pull/57
ibexa/http-cache#72
https://github.com/ibexa/seo/pull/51
https://github.com/ibexa/elasticsearch/pull/60
ibexa/solr#97
https://github.com/ibexa/connect/pull/51
https://github.com/ibexa/migrations/pull/413
ibexa/behat#148
Description:
Publishing content type that previously used legacy field type aliases will rebrand old aliases to new ones.
The same goes for contents, new version will always use new aliases.
List of rebranded identifiers with legacy aliases:
For QA:
Documentation: