symfony - How to get just one item of related entity in Twig -
I have the "person" unit, whose property is "condition" and this property has an objective relationship in theory.
/ ** * * @ORM \ OneToMany (target = "\ my \ bundle \ object \ status", mapped = "person") * ** / protected $ status; To demonstrate in my view, what I have to do is only the final position.
How do I get the last position in my twin sequence? Is there something like this, for example, {{person.status.last}}?
Should I inquire about the last condition of my controller and should see it as another war?
Yes, you can do it like this {{person.status.last .someField}} to resemble a someField property of the last position (natural query order) for the individual object This is possible because person.status is a Theory collection is in which there are methods like earlier or last . You can check for more information.
Comments
Post a Comment