8000 IBX-9947: Rebranded field type identifiers by barw4 · Pull Request #543 · ibexa/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 24 commits into from
Jun 5, 2025

Conversation

barw4
Copy link
Contributor
@barw4 barw4 commented May 23, 2025
🎫 Issue IBX-9947

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:

 ---------------------------------------------------------- ----------------------------------------------------------------- ---------------------------------------------------- ---------------------------------------------------------- 
  Service ID                                                 alias                                                             legacy_alias                                         Class name                                                
 ---------------------------------------------------------- ----------------------------------------------------------------- ---------------------------------------------------- ---------------------------------------------------------- 
  Ibexa\Core\FieldType\Author\Type                           ibexa_author                                                      ezauthor                                             Ibexa\Core\FieldType\Author\Type                          
  Ibexa\Core\FieldType\BinaryFile\Type                       ibexa_binaryfile                                                  ezbinaryfile                                         Ibexa\Core\FieldType\BinaryFile\Type                      
  Ibexa\Core\FieldType\Checkbox\Type                         ibexa_boolean                                                     ezboolean                                            Ibexa\Core\FieldType\Checkbox\Type                        
  Ibexa\Core\FieldType\Country\Type                          ibexa_country                                                     ezcountry                                            Ibexa\Core\FieldType\Country\Type                         
  Ibexa\Core\FieldType\Date\Type                             ibexa_date                                                        ezdate                                               Ibexa\Core\FieldType\Date\Type                            
  Ibexa\Core\FieldType\DateAndTime\Type                      ibexa_datetime                                                    ezdatetime                                           Ibexa\Core\FieldType\DateAndTime\Type                     
  Ibexa\Core\FieldType\Time\Type                             ibexa_time                                                        eztime                                               Ibexa\Core\FieldType\Time\Type                            
  Ibexa\Core\FieldType\EmailAddress\Type                     ibexa_email                                                       ezemail                                              Ibexa\Core\FieldType\EmailAddress\Type                    
  Ibexa\Core\FieldType\Float\Type                            ibexa_float                                                       ezfloat                                              Ibexa\Core\FieldType\Float\Type                           
  Ibexa\Core\FieldType\Integer\Type                          ibexa_integer                                                     ezinteger                                            Ibexa\Core\FieldType\Integer\Type                         
  Ibexa\Core\FieldType\Image\Type                            ibexa_image                                                       ezimage                                              Ibexa\Core\FieldType\Image\Type                           
  Ibexa\Core\FieldType\ISBN\Type                             ibexa_isbn                                                        ezisbn                                               Ibexa\Core\FieldType\ISBN\Type                            
  Ibexa\Core\FieldType\Keyword\Type                          ibexa_keyword                                                     ezkeyword                                            Ibexa\Core\FieldType\Keyword\Type                         
  Ibexa\Core\FieldType\Media\Type                            ibexa_media                                                       ezmedia                                              Ibexa\Core\FieldType\Media\Type                           
  Ibexa\Core\FieldType\Relation\Type                         ibexa_object_relation                                             ezobjectrelation                                     Ibexa\Core\FieldType\Relation\Type                        
  Ibexa\Core\FieldType\Selection\Type                        ibexa_selection                                                   ezselection                                          Ibexa\Core\FieldType\Selection\Type                       
  Ibexa\Core\FieldType\TextBlock\Type                        ibexa_text                                                        eztext                                               Ibexa\Core\FieldType\TextBlock\Type                       
  Ibexa\Core\FieldType\TextLine\Type                         ibexa_string                                                      ezstring                                             Ibexa\Core\FieldType\TextLine\Type                        
  Ibexa\Core\FieldType\Url\Type                              ibexa_url                                                         ezurl                                                Ibexa\Core\FieldType\Url\Type                             
  Ibexa\Core\FieldType\MapLocation\Type                      ibexa_gmap_location                                               ezgmaplocation                                       Ibexa\Core\FieldType\MapLocation\Type                     
  Ibexa\Core\FieldType\RelationList\Type                     ibexa_object_relation_list                                        ezobjectrelationlist                                 Ibexa\Core\FieldType\RelationList\Type                    
  Ibexa\Core\FieldType\User\Type                             ibexa_user                                                        ezuser                                               Ibexa\Core\FieldType\User\Type                            
  ibexa.field_type.ibexa_matrix                              ibexa_matrix                                                      ezmatrix                                             Ibexa\Core\FieldType\Null\Type                            
  Ibexa\FieldTypeRichText\FieldType\RichText\Type            ibexa_richtext                                                    ezrichtext                                           Ibexa\FieldTypeRichText\FieldType\RichText\Type           
  Ibexa\FieldTypeMatrix\FieldType\Type                       %ibexa.field_type.matrix.identifier%                              %ibexa.field_type.matrix.legacy_identifier%          Ibexa\FieldTypeMatrix\FieldType\Type                      
  Ibexa\FieldTypeQuery\FieldType\Query\Type                  %ibexa.field_type.query.content.identifier%                       %ibexa.field_type.query.content.legacy_identifier%   Ibexa\FieldTypeQuery\FieldType\Query\Type                 
  Ibexa\Connector\Dam\FieldType\ImageAsset\Type              ibexa_image_asset                                                 ezimageasset                                         Ibexa\Connector\Dam\FieldType\ImageAsset\Type             
  Ibexa\Seo\FieldType\SeoType                                ibexa_seo                                                                                                              Ibexa\Seo\FieldType\SeoType                               
  Ibexa\Measurement\FieldType\MeasurementType                ibexa_measurement                                                                                                      Ibexa\Measurement\FieldType\MeasurementType               
  Ibexa\ProductCatalog\FieldType\CustomerGroup\Type          ibexa_customer_group                                                                                                   Ibexa\ProductCatalog\FieldType\CustomerGroup\Type         
  Ibexa\ProductCatalog\FieldType\ProductSpecification\Type   ibexa_product_specification                                                                                            Ibexa\ProductCatalog\FieldType\ProductSpecification\Type  
  Ibexa\Taxonomy\FieldType\TaxonomyEntry\Type                %ibexa.taxonomy.fieldtype.taxonomy_entry.identifier%                                                                   Ibexa\Taxonomy\FieldType\TaxonomyEntry\Type               
  Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Type      %ibexa.taxonomy.fieldtype.taxonomy_entry_assignment.identifier%                                                        Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Type     
  Ibexa\FieldTypePage\FieldType\LandingPage\Type             ibexa_landing_page                                                ezlandingpage                                        Ibexa\FieldTypePage\FieldType\LandingPage\Type            
  Ibexa\FormBuilder\FieldType\Type                           ibexa_form                                                        ezform                                               Ibexa\FormBuilder\FieldType\Type                          
  Ibexa\FieldTypeAddress\FieldType\Type                      %ibexa.field_type.address.identifier%                                                                                  Ibexa\FieldTypeAddress\FieldType\Type                     
 ---------------------------------------------------------- ----------------------------------------------------------------- ---------------------------------------------------- ---------------------------------------------------------- 

For QA:

Documentation:

],
);
}

Copy link
Contributor Author
@barw4 barw4 Jun 3, 2025

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.

Copy link
Contributor

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];
Copy link
Contributor Author

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.

Comment on lines +250 to +251
$dataTypeString = $row['content_type_field_definition_data_type_string'];
$dataTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($dataTypeString);
Copy link
Contributor Author
@barw4 barw4 Jun 3, 2025

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

Copy link
Contributor

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

],
);
}

Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor

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'])
Copy link
Contributor

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?

Copy link
Contributor Author
@barw4 barw4 Jun 5, 2025

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') {
Copy link
Contributor

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.

Comment on lines +250 to +251
$dataTypeString = $row['content_type_field_definition_data_type_string'];
$dataTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($dataTypeString);
Copy link
Contributor

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

@@ -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? :/
Copy link
Contributor

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.

@barw4 barw4 force-pushed the ibx-9947-rebrand-ft-identifiers branch from 0d68129 to 448692b Compare June 5, 2025 08:19
Comment on lines +583 to +586
$fieldTypeString = $row['content_field_data_type_string'];
$fieldTypeString = $this->fieldTypeAliasResolver->resolveIdentifier($fieldTypeString);

$field->type = $fieldTypeString;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@barw4 barw4 marked this pull request as ready for review June 5, 2025 08:20
@adamwojs adamwojs force-pushed the ibx-9947-rebrand-ft-identifiers branch from 4885801 to 65c37af Compare June 5, 2025 19:47
Copy link
sonarqubecloud bot commented Jun 5, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
4.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Member
@adamwojs adamwojs left a 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).

@adamwojs adamwojs merged commit 12abb87 into main Jun 5, 2025
12 of 15 checks passed
@adamwojs adamwojs deleted the ibx-9947-rebrand-ft-identifiers branch June 5, 2025 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature request Ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0