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

    XMLWordPrintable

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:
        Unable to find source-code formatter for language: yml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
        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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jacek.foremski-obsolete@ez.no Jacek Foremski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: