Details
-
Bug
-
Resolution: Fixed
-
High
-
2.5.9, 3.0.5
-
Clean installation of eZ Platform 2.5.9 / 3.0.1
Description
Steps to reproduce:
- Create new ContentType called "Author" with identifier "author" with "Text line" as a single fieldtype called "name"
- 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 - Create new "Author" Content with field name filled as "Joe Joe"
- Get ID of newly created "Author" Content (in code example content's ID = 58)
- 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