Récupérer une colonne d'une autre table
Bonjour,
Je débute avec symfony ainsi qu'en php (oui je sais c'est peut-être pas très malin). Je suis en train de suivre le tuto jobeet et je mène mes expériences en même temps à côté.
Imaginons 2 tables
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#config/doctrine/schema.yml
AnimalCategory:
actAs: { Timestampable: ~ }
columns:
name: { type: string(20), notnull: true, unique: true }
Animal:
actAs: { Timestampable: ~ }
columns:
category_id: { type: integer, notnull: true }
animal_name: { type: string(20), notnull: true }
relations:
AnimalCategory: { onDelete: CASCADE, local: category_id, foreign: id, foreignAlias: Animals } |
Si j'affiche la liste des animaux j'ai pour chacun l'id correspondant à AnimalCategory. Normal.
Comment faire pour avoir le nom correspondant à category_id lors de l'action Index ?