Uploaded image for project: 'eZ Platform Enterprise Edition'
  1. eZ Platform Enterprise Edition
  2. EZEE-3368

ImageAsset destinationContentId is stored in wrong format

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: High High
    • None
    • 3.2.0, 3.2.1
    • Studio Demo Bundle

    Description

      Steps to reproduce
      Create a contentType with ezimageasset field type.
      Create a content and upload image.
      Publish content.
      View content with image in front or admin.

      Related to Bug https://issues.ibexa.co/browse/EZEE-3347

      Affects
      The issue affects the component "eZ Platform Connector DAM" v1.0.1 which could not be selected here. Maybe you add this as selectable component.

      Result
      ContentService::loadContent() fails, as the function expects int as contentId, but string is provided as destinationContentId.

      It seems that the destinationContentId is serialized as string in database:

      select id,data_int,data_text from ezcontentobject_attribute where data_type_string='ezimageasset';
       
      {"destinationContentId":"96","alternativeText":null,"source":null} 

      Loading Relation

      The ImageAssetValueTransformer::reverseTransform() instances a new  ImageAsset\Value object including string representation of destinationContentId, which should be integer.

      Changing{{ ImageAsset\Value}} property $destinationContentId to int solves loading issue.

      Persistence of Relation
      The ImageAsset\Mapper\FormMapper::mapFieldValueForm() passing string data from Form to API as string. A conversion from string to int in ImageAssetValueTransformer::reverseTransform() solves persistence isse, data is stored correctly as int in database and later instanced correctly as Value() with integer.

      Database entry after patch applied.

      | 403 |     NULL | {"destinationContentId":91,"alternativeText":null,"source":null}   | 

      It seems that the reverseTransform function is called directly from Symfony Forms:

      string(90) "Ibexa\Platform\Connector\Dam\Form\Transformer\ImageAssetValueTransformer::reverseTransform"
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Form.php:1085
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Form.php:646
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Form.php:576
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Form.php:576
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Form.php:576
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php:109
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/form/Form.php:490
      /Users/artur/www/platform.sh/km-opec/vendor/ezsystems/ezplatform-content-forms/src/lib/Content/View/Filter/ContentEditViewFilter.php:96
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/EventDispatcher.php:230
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/EventDispatcher.php:59
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151
      /Users/artur/www/platform.sh/km-opec/vendor/ezsystems/ezplatform-kernel/eZ/Bundle/EzPublishCoreBundle/EventListener/ViewControllerListener.php:67
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:117
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/EventDispatcher.php:230
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/EventDispatcher.php:59
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:151
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/http-kernel/HttpKernel.php:145
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/http-kernel/HttpKernel.php:79
      /Users/artur/www/platform.sh/km-opec/vendor/symfony/http-kernel/Kernel.php:196
      /Users/artur/www/platform.sh/km-opec/public/index.php:42 
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            artur.wawrzynkiewicz@ibexa.co Artur Wawrzynkiewicz
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: