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

Related content is still displayed after it is moved to trash

    Details

      Description

      If the Content Object is related using Object Relation Field Type to another Content Object and the former is moved to trash, then the deleted Content Object is still shown when using ez_render_field in the template.

      Steps to reproduce

      1. Create new eZ Platform installation.
      2. Create new Content Type with Identifier relation_content_type and two Field definitions:
        • Text Line with Identifier title,
        • Content relation (single) with Identifier relation.
      3. Add the following configuration to app/config/ezplatform.yml:

        ezpublish:
            system:
                site_group:
        	    content_view:
                        full:
                            relation_content_type:
                                template: AppBundle:full:relation_content_type.html.twig
                                match:
                                    Identifier\ContentType: [relation_content_type]
        

      4. Create file src/AppBundle/Resources/views/full/relation_content_type.html.twig with the following contents:

        {% extends noLayout ? viewbaseLayout : "EzPublishCoreBundle::pagelayout.html.twig" %}
         
        {% block content %}
            <h1>{{ ez_render_field( content, 'title' ) }}</h1>
            {{ dump(ez_field_value(content, 'relation')) }}
            {{ ez_render_field(content, 'relation') }}
        {% endblock %}
        

      5. In the back-office, create and publish new Article Content Type (under "eZ Platform" root Folder) named "Test Article".
      6. In the back-office, create and publish new "Relation Content Type" Content Type (under "eZ Platform" root Folder) named "Test Relation". In the Relation field, select "Test Article".
      7. In the front-office, navigate to "/Test-Relation". Confirm that the field value dump contains valid destinationContentId. Also, confirm that the related Content Object "Test Article" is also displayed. This is the correct behaviour.
      8. In the back-office, navigate to "Test Article" and send it to trash.
      9. In the front-office, navigate to "/Test-Relation" again. Notice that the field value dump contains valid destinationContentId. Also, notice that the related Content Object "Test Article" is still displayed. The field value dump should contain destinationContentId equal to null. Also, the related Content Object "Test Article" shouldn't be displayed.
      10. In the back-office, navigate to Trash and empty it.
      11. In the front-office, navigate to "/Test-Relation" again. Notice that the field value dump contains destinationContentId equal to null. Also, notice that the related Content Object "Test Article" is no longer displayed. This is the correct behaviour.

      Warning: you need to enable debug for the dump function to work in Twig.

        Issue Links

          Activity

          Show
          Adam Wójs added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/2287
          Show
          Adam Wójs added a comment - Merged: https://github.com/ezsystems/ezpublish-kernel/commit/060f9d825d281edfa020715e51405bd59aea427a

            People

            • Assignee:
              Unassigned
              Reporter:
              Jacek Foremski (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: