It have two entity in PhotoBundle, one is Photo entity, another one is FileManaged entity. they have ONE-TO-ONE relation.
Hy\PhotoBundle\Entity\Photo:
type: entity
oneToOne:
file_managed:
targetEntity: FileManaged
mappedBy: photo
joinColumn:
name: photo
referencedColumnName: fid
Hy\PhotoBundle\Entity\FileManaged:
type: entity
oneToOne:
photo:
targetEntity: Photo
joinColumn:
name: fid
referencedColumnName: photo
I want to print uri in photo's index.html.twig file, how to print it?
My Code is:
{% for entity in pagination %}
{{ entity.title }} <!--Ok-->
{{ entity.file_managed.uri }} <!--Error-->{% endfor %}
and it show an error message:
Method "file_managed" for object "Hy\PhotoBundle\Entity\Photo" does not exist in HyPhotoBundle:Photo:index.html.twig at line 25
What I'm doing wrong?
the pic is using ladybug dump:
{{ entity|ladybug_dump }}