Details
-
Bug
-
Resolution: Fixed
-
High
-
5.4.10
-
None
Description
When trying to save/publish a Content Object that has ezobjectrelationlist Field Type with the related object that no longer exists (because it was moved to trash) using Public PHP API the following error is shown:
[RuntimeException] Missing relation-item external data property: ezcontentobject_tree_node_id
This issue is already fixed in eZ Platform: EZP-26342. Probably the backport to 5.4 is enough to fix it.
Steps to reproduce
- Create new eZ Publish installation.
- Create new article named "Test Article".
- Create a new Content Type named "Multiple Relations Content Type" with two Content Fields:
- ezstring named "Title".
- ezobjectrelationlist named "Relations".
- Create new Content Object with "Multiple Relations Content Type" Content Type. In the "Title" field type "Multiple Relations Test" and in the "Relations" field select "Test Article".
- Move "Test Article" to trash
- Add the following command to your App Bundle:
<?php namespace AppBundle\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class TestCommand extends ContainerAwareCommand { /** * {@inheritdoc} */ protected function configure() { $this ->setName('app:test_command'); } /** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $repository = $this->getContainer()->get('ezpublish.api.repository'); $userService = $repository->getUserService(); $user = $userService->loadUserByLogin('admin'); $repository->setCurrentUser($user); $contentService = $repository->getContentService(); $content = $contentService->loadContent(64); $contentUpdateStruct = $contentService->newContentUpdateStruct(); $contentUpdateStruct->setField('title', 'Multiple Relations Test 2'); $contentDraft = $contentService->createContentDraft($content->contentInfo); $contentDraft = $contentService->updateContent($contentDraft->versionInfo, $contentUpdateStruct); $content = $contentService->publishVersion($contentDraft->versionInfo); var_dump($content); } }
- Run the command by entering the following in the console:
php ezpublish/console app:test_command
- You will be presented with the error described above.
Attachments
Issue Links
- relates to
-
EZP-26342 Nonexistent object in ezobjectrelationlist results in error 500
- Closed