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

Failures in Public API when setting remote id on Location on create

    Details

      Description

      The following failure occurs in legacy integration tests when ran against MySQL backend:

      eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionCreatesLocationsDefinedOnCreate
      eZ\Publish\Core\Base\Exceptions\NotFoundException: Could not find 'location' with identifier '0123456789abcdef0123456789abcdef'

      /home/eddie/ezp-next/eZ/Publish/Core/Persistence/Legacy/Content/Location/Gateway/EzcDatabase.php:105
      /home/eddie/ezp-next/eZ/Publish/Core/Persistence/Legacy/Content/Location/Gateway/ExceptionConversion.php:74
      /home/eddie/ezp-next/eZ/Publish/Core/Persistence/Legacy/Content/Location/Handler.php:110
      /home/eddie/ezp-next/eZ/Publish/Core/Repository/LocationService.php:201
      /home/eddie/ezp-next/eZ/Publish/API/Repository/Tests/ContentServiceTest.php:891

      Background story:

      In eZ Publish 4 it is not possible to set the remote ID of the node when publishing an object, while in PAPI it is possible to do so.

      To employ such functionality in PAPI, eznode_assignment.remote_id field is used to store the user defined remote ID between creating a draft and publishing it, when it is copied over to ezcontentobject_tree.remote_id. In eZ Publish 4, eznode_assignment.remote_id is empty after publishing an object (i.e. not used)

      Issue with this approach in PAPI is that eznode_assignment.remote_id is int(11), while ezcontentobject_tree.remote_id is varchar, which makes it impossible to create non numeric remote IDs, which the failing test does.

      This test passed while running integration tests on sqlite backend because SQLite stores and reads integers internally as strings.

        Issue Links

          Activity

          Hide
          André Rømcke added a comment -

          Could we change the column to be varchar? How would that potentially affect legacy kernel?

          Show
          André Rømcke added a comment - Could we change the column to be varchar? How would that potentially affect legacy kernel?
          Show
          Patrick Allaert (Inactive) added a comment - PR at: https://github.com/ezsystems/ezpublish/pull/502 https://github.com/ezsystems/ezoracle/pull/8
          Hide
          Edi Modrić (Inactive) added a comment -

          I've found usages of eznode_assignment.remote_id where it is compared with 0 for example or set to 0.

          https://github.com/ezsystems/ezpublish/blob/master/kernel/classes/ezcontentobject.php#L1316
          https://github.com/ezsystems/ezpublish/blob/master/kernel/classes/eznodeassignment.php#L198

          Can't really say if it will break anything.

          Show
          Edi Modrić (Inactive) added a comment - I've found usages of eznode_assignment.remote_id where it is compared with 0 for example or set to 0. https://github.com/ezsystems/ezpublish/blob/master/kernel/classes/ezcontentobject.php#L1316 https://github.com/ezsystems/ezpublish/blob/master/kernel/classes/eznodeassignment.php#L198 Can't really say if it will break anything.
          Hide
          Patrick Allaert (Inactive) added a comment -

          I know, I found them as well, but by using varchar and since 0 is inserted, we shouldn't have any BC break at all.

          Show
          Patrick Allaert (Inactive) added a comment - I know, I found them as well, but by using varchar and since 0 is inserted, we shouldn't have any BC break at all.
          Hide
          Edi Modrić (Inactive) added a comment -

          Then +1 from me.

          Show
          Edi Modrić (Inactive) added a comment - Then +1 from me.
          Hide
          Gaetano Giunta (Inactive) added a comment -

          Side notes:
          a. remember that in oracle null === '' when doing comparisons
          b. are we enforcing uniqueness of remote_ids on node_assigments? should we?

          Show
          Gaetano Giunta (Inactive) added a comment - Side notes: a. remember that in oracle null === '' when doing comparisons b. are we enforcing uniqueness of remote_ids on node_assigments? should we?
          Hide
          Patrick Allaert (Inactive) added a comment -

          Uniqueness is not enforced as it would cause a huge BC break: currently that table is containing 0 as remote_id for all records which wouldn't be possible with a unique constraint.

          Show
          Patrick Allaert (Inactive) added a comment - Uniqueness is not enforced as it would cause a huge BC break: currently that table is containing 0 as remote_id for all records which wouldn't be possible with a unique constraint.
          Hide
          Patrick Allaert (Inactive) added a comment -

          Additional PR that effectively solves the issue in ezp-next: https://github.com/ezsystems/ezp-next/pull/155

          Show
          Patrick Allaert (Inactive) added a comment - Additional PR that effectively solves the issue in ezp-next: https://github.com/ezsystems/ezp-next/pull/155

            People

            • Assignee:
              Unassigned
              Reporter:
              Edi Modrić
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 5 minutes
                6h 5m