Can't render some variables in twig template

Mufanu

I've written my application using ZF2. I have 2 modules: mail and file. All vars from mail module are rendered. Can't render object file. When I do {{ dump(mail.file) }} it returns NULL. But if I do {{ dump() }} the file object does exist:

array (size=2)
  'mail' => 
    object(Mail\Entity\Incoming)[453]
      protected 'id' => int 8
      protected 'inNumber' => int 1
      protected 'inDate' => int 1320948000
      protected 'outNumber' => string '1' (length=1)
      protected 'outDate' => int 1320948000
      protected 'sheetsNumber' => int 1
      protected 'teaser' => string '' (length=0)
      protected 'file' => 
        object(File\Entity\File)[455]
          protected 'id' => int 5
          protected 'origName' => string 'eRa33cHgofw.jpg' (length=15)
          protected 'curName' => string 'eRa33cHgofw.jpg' (length=15)
          protected 'size' => int 284192
          protected 'type' => string 'image/jpeg' (length=10)
          protected 'uploaded' => int 1385736080
      protected 'sender' => 
        object(Mail\Entity\Sender)[457]
          protected 'id' => int 1
          protected 'name' => string 'ООО Ромашка' (length=21)
      protected 'type' => 
        object(Mail\Entity\Type)[459]
          protected 'id' => int 1
          protected 'name' => string 'Информация' (length=20)
      protected 'created' => int 1385736080
  'namespace' => string 'FileEntityFile' (length=14)

Anyone help me?

Tomdarkness

The file property in the Mail\Entity\Incoming class is protected hence it is only accessible from within the class itself or any children of the Mail\Entity\Incoming class. This why twig can't access that property.

Either make the property public or create an accessor function within the Mail\Entity\Incoming class.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't render date in template

From Dev

Render object as context in twig template

From Dev

Why controller not render twig template

From Dev

How can I define global variables inside a twig template file?

From Dev

Can`t render django form in the template

From Dev

FOSUserBundle understanding twig template variables

From Dev

Symfony/Twig can't extend a template when displaying a grid with APYDataGridBundle

From Dev

Thymeleaf doesn't render variables within messages in some locales

From Dev

OneupUploaderBundle: Render response message in twig template

From Dev

Twig - variable set in template will not render will called later

From Dev

Drupal 8: render view in twig template

From Dev

How to render a Twig template without passing any array to render() method?

From Dev

Add class in some tags via twig template?

From Dev

laravel4.1 can't render template when upload to server

From Dev

Symfony: Is there any way to render a twig template using a relative path to the template?

From Dev

render_template can't find template, send_file can

From Dev

Unable to find Twig template using render method in Symfony 2

From Dev

How do I render a controller returned image in a Twig template

From Dev

render a complete twig template extending another one with ajax in Symfony

From Dev

How do I render a controller returned image in a Twig template

From Dev

Flask render_template() & **locals() arg not working... Won't display python variables in HTML text

From Dev

Can you use global variables inside a t4 template?

From Dev

Can't find file location to change template variables for {{ Title }}

From Dev

Opencart template doesn't render

From Dev

php twig get variables passed to render in extension function

From Dev

Why can some variables of reference type bind rvalues and some can't?

From Dev

Classic ASP render a template and send variables

From Dev

Unable to find template "SonataCoreBundle:FlashMessage:render.html.twig" in SonataAdminBundle::standard_layout.html.twig

From Dev

Unable to find template "SonataCoreBundle:FlashMessage:render.html.twig" in SonataAdminBundle::standard_layout.html.twig

Related Related

  1. 1

    Can't render date in template

  2. 2

    Render object as context in twig template

  3. 3

    Why controller not render twig template

  4. 4

    How can I define global variables inside a twig template file?

  5. 5

    Can`t render django form in the template

  6. 6

    FOSUserBundle understanding twig template variables

  7. 7

    Symfony/Twig can't extend a template when displaying a grid with APYDataGridBundle

  8. 8

    Thymeleaf doesn't render variables within messages in some locales

  9. 9

    OneupUploaderBundle: Render response message in twig template

  10. 10

    Twig - variable set in template will not render will called later

  11. 11

    Drupal 8: render view in twig template

  12. 12

    How to render a Twig template without passing any array to render() method?

  13. 13

    Add class in some tags via twig template?

  14. 14

    laravel4.1 can't render template when upload to server

  15. 15

    Symfony: Is there any way to render a twig template using a relative path to the template?

  16. 16

    render_template can't find template, send_file can

  17. 17

    Unable to find Twig template using render method in Symfony 2

  18. 18

    How do I render a controller returned image in a Twig template

  19. 19

    render a complete twig template extending another one with ajax in Symfony

  20. 20

    How do I render a controller returned image in a Twig template

  21. 21

    Flask render_template() & **locals() arg not working... Won't display python variables in HTML text

  22. 22

    Can you use global variables inside a t4 template?

  23. 23

    Can't find file location to change template variables for {{ Title }}

  24. 24

    Opencart template doesn't render

  25. 25

    php twig get variables passed to render in extension function

  26. 26

    Why can some variables of reference type bind rvalues and some can't?

  27. 27

    Classic ASP render a template and send variables

  28. 28

    Unable to find template "SonataCoreBundle:FlashMessage:render.html.twig" in SonataAdminBundle::standard_layout.html.twig

  29. 29

    Unable to find template "SonataCoreBundle:FlashMessage:render.html.twig" in SonataAdminBundle::standard_layout.html.twig

HotTag

Archive