Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-25472

Updating a Page Field with the public API erases rotation information

    XMLWordPrintable

Details

    Description

      Using the API to update content objects with flow blocks, breaks these flow blocks.

      Although it is documented that this field type is not to be updated using the API, as a developer, I would like to have this fixed.

      steps to reproduce
      • edit a landing page and setup a block, setting rotation to any value (say 10m)
      • using the api, create a draft of this landing page and publish it (without changing anything)
        => expected result: nothing should change
        => actual result: the flow block is broken in the database

      XML in the database, before updating through the API

      <page>
        <zone_layout>2ZonesLayout1</zone_layout>
        <zone id="id_865346aabbcc48a9839274cc554868be">
          <zone_identifier>left</zone_identifier>
          <block id="id_192004ddbe930397906c912391d58de1">
            <name></name>
            <zone_id>865346aabbcc48a9839274cc554868be</zone_id>
            <type>ItemList</type>
            <view>default</view>
            <overflow_id></overflow_id>
            <rotation>
              <interval>600</interval>
              <type>1</type>
              <value>10</value>
              <unit>2</unit>
            </rotation>
          </block>
        </zone>
        <zone id="id_f742abffba08fc849b6e80dec769a74c">
          <zone_identifier>right</zone_identifier>
        </zone>
      </page>
      

      Resulting XML

      <page>
        <zone id="id_865346aabbcc48a9839274cc554868be">
          <block id="id_192004ddbe930397906c912391d58de1">
            <type>ItemList</type>
            <view>default</view>
            <overflow_id></overflow_id>
            <rotation/>
            <interval>600</interval>
            <type>1</type>
            <value>10</value>
            <unit>2</unit>
            <zone_id>865346aabbcc48a9839274cc554868be</zone_id>
          </block>
          <zone_identifier>left</zone_identifier>
        </zone>
        <zone id="id_f742abffba08fc849b6e80dec769a74c">
          <zone_identifier>right</zone_identifier>
        </zone>
        <zone_layout>2ZonesLayout1</zone_layout>
      </page>
      

      Example command source

        protected function execute(InputInterface $input, OutputInterface $output) {
          $repository = $this->getContainer()->get('ezpublish.api.repository');
      
          $repository->setCurrentUser($repository->getUserService()->loadUser(14));
      
          $contentService = $repository->getContentService();
      
          $contentInfo = $contentService->loadContentInfo(57);
          $contentDraft = $contentService->createContentDraft($contentInfo);
      
          $content = $contentService->publishVersion($contentDraft->versionInfo);
        }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            joaquim.cavalleri-obsolete@ez.no Joaquim Cavalleri (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: