user4383363
user4383363

Reputation:

How to retrieve the foreign key as a number in Symfony2?

I have two related tables called Budget and Client. The Budget's client field is the foreign key that stores the Client's id. Symfony2 does something that when I print in a twig template the client field, it automatically shows the name of the Client table. How can I make it retrieve the identifier/number of the foreign key, accessing this client field?

Upvotes: 0

Views: 276

Answers (1)

Ragdata
Ragdata

Reputation: 1186

Assuming you've provided Getters & Setters for your Entity Classes, it should be as simple as:

{{ client.id }}

Upvotes: 1

Related Questions