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

Content created with Public API with no Location breaks Admin UI in several places

    XMLWordPrintable

    Details

      Description

      Steps to reproduce:

      1. Create new ContentType called "Author" with identifier "author" with "Text line" as a single fieldtype called "name"
      2. Create new ContentType called "Book" with identifier "book" with following fieldtypes:
        a) Text line -> "title"
        b) Single relation -> "author" -> mark previously created "Author" CT as a valid relation
        c) Multiple relations -> "authors" -> mark previously created "Author" CT as a valid relation
      3. Create new "Author" Content with field name filled as "Joe Joe"
      4. Get ID of newly created "Author" Content (in code example content's ID = 58)
      5. Using PHP Public API create "Book" content using following code:
                $contentType = $this->contentTypeService->loadContentTypeByIdentifier('book');
                $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, 'eng-GB');
                $contentCreateStruct->setField('title', 'BOOK PUBLISHED WITH API');
                $contentCreateStruct->setField('author',58);
                $contentCreateStruct->setField('authors',58);
                $draft = $this->contentService->createContent($contentCreateStruct, []);
                $content = $this->contentService->publishVersion($draft->getVersionInfo());

      6. Create reverse relation:

              $contentType = $this->contentTypeService->loadContentTypeByIdentifier('book');
              $contentCreateStruct = $this->contentService->newContentCreateStruct($contentType, 'eng-GB');
              $contentCreateStruct->setField('title', 'Harry Potter');
              $contentCreateStruct->setField('author',60);
              $contentCreateStruct->setField('authors',60);
              $locationCreateStruct = new LocationCreateStruct();
              $locationCreateStruct->parentLocationId = 2;
              $locationCreateStruct->sortField = 1;
              $locationCreateStruct->sortOrder = 1;
              $draft = $this->contentService->createContent($contentCreateStruct, [$locationCreateStruct]);
              $content = $this->contentService->publishVersion($draft->getVersionInfo());
      

      7. Try to search for newly created "Book" content by title (exception on v2.5) -> try to access found content (exception on v3.0)
      8. Try to access relations tab in "Joe Doe" content (exception on v2.5) -> try to access found content (exception on v3.0)
      9. Try to access "Harry Potter" book and check relation tables (v3.0)

      Result:
      Exceptions are thrown in steps #6 and #7

      Expected result:
      No exceptions are thrown in steps #6 and #7

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            bartlomiej.wajda@ez.no Bartłomiej Wajda
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: