Details
-
Bug
-
Resolution: Fixed
-
High
-
1.7.5, 1.11.0
-
None
Description
If the Content Object (eg. File) is embedded using Rich Text Field into another Content Object (eg. Folder) and the former is deleted (moved to trash), then displaying the Folder Content Object in the front-office should not include the deleted File Content Object. Currently, however, the following exception is thrown:
Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Cannot generate an UrlAlias route for content without main location.")." at xxx\vendor\ezsystems\ezpublish-kernel\eZ\Bundle\EzPublishCoreBundle/Resources/views/default/content/embed.html.twig line 6 Context: { "exception": "Exception(Twig_Error_Runtime): An exception has been thrown during the rendering of a template (\"Cannot generate an UrlAlias route for content without main location.\")." }
There is a similar problem in the eZ Publish, but since steps to reproduce are a little different and the end result is also different, I have separated the issues. The one regarding eZ Publish 5.4 can be found here: EZP-28122.
Steps to reproduce
- Create new eZ Platform installation.
- In the back-office, create new Folder Content Type under "eZ Platform" named "Test Folder".
- In the Media/Files, create new File Content Type named "Test File".
- Edit the "Test Folder". In the "Description" field, embed the "Test file" using the "+" and "Embed" buttons from the Rich Text Editor. Publish "Test Folder".
- In the front-office, navigate to "/Test-Folder". Confirm that the embedded Content Object "Test file" is also displayed.
- In the backoffice, navigate to "Media/Files/Test file" and remove it by sending it to trash.
- In the front-office, navigate to "/Test-Folder" again. If you are using "dev" environment, the above exception will be displayed. If you are using "prod" environment, you can find the following exception in the app/logs/prod.log file:
[2017-10-23 14:14:47] request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("Cannot generate an UrlAlias route for content without main location.")." at C:\Apache24\htdocs\ezplatform\vendor\ezsystems\ezpublish-kernel\eZ\Bundle\EzPublishCoreBundle/Resources/views/default/content/embed.html.twig line 6 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"Cannot generate an UrlAlias route for content without main location.\"). at C:\\Apache24\\htdocs\\ezplatform\\vendor\\ezsystems\\ezpublish-kernel\\eZ\\Bundle\\EzPublishCoreBundle/Resources/views/default/content/embed.html.twig:6, LogicException(code: 0): Cannot generate an UrlAlias route for content without main location. at C:\\Apache24\\htdocs\\ezplatform\\vendor\\ezsystems\\ezpublish-kernel\\eZ\\Publish\\Core\\MVC\\Symfony\\Routing\\UrlAliasRouter.php:345)"} []