Eva Dias
Eva Dias

Reputation: 1747

Getting another field from a foreign table from an id symfony

I have two tables (feasy_marcacao and feasy_servico). For now I have this code:

<td><?php echo $feasy_marcacao->getServicoId() ?></td>

but this gets me the Id number and I want the description for that id. Here it is my schema:

FeasyServico:
  columns:
    descricao: { type: string(255), notnull: true, unique: true }

FeasyMarcacao:
  actAs: { Timestampable: ~ }
  columns:
    nome: { type: string(255), notnull: true }
    email: { type: string(255), notnull: true }
    contacto: { type: string(255), notnull: true }
    servico_id: { type: integer, notnull: true }
    dia: { type: date, notnull: true }
    hora: { type: time, notnull: true }
  relations:
    FeasyServico: { onDelete: CASCADE, local: servico_id, foreign: id }

Hope I explained myself well. Thank you for your time.

Upvotes: 0

Views: 179

Answers (1)

domi27
domi27

Reputation: 6923

Straight forward :

echo $feasy_marcacao->getFeasyServico()->getDescricao();

Upvotes: 2

Related Questions