Robię stronkę klubu piłkarskiego i mam problem z wyświetlaniem nazwy drużyn w module administracji.
Oto fragment pliku schema.yml:
Kod
klub:
_attributes: { phpName: Przeciwnicy }
id:
kto: varchar(255)
zkim: varchar(255)
pkt: integer
result:
_attributes: { phpName: Result }
id:
kto: { type: integer, foreignTable: klub, foreignReference: id, onDelete: cascade }
zkim: { type: integer, foreignTable: klub, foreignReference: id, onDelete: cascade }
wynik: varchar(64)
zapisano: boolean
created_at:
_attributes: { phpName: Przeciwnicy }
id:
kto: varchar(255)
zkim: varchar(255)
pkt: integer
result:
_attributes: { phpName: Result }
id:
kto: { type: integer, foreignTable: klub, foreignReference: id, onDelete: cascade }
zkim: { type: integer, foreignTable: klub, foreignReference: id, onDelete: cascade }
wynik: varchar(64)
zapisano: boolean
created_at:
W akcji list modułu result widać id pól kto i zkim z tabeli klub, a mi zależy na tym, żeby były tam nazwy klubów.
Gdy miałem tylko jedno odwołanie w tebeli result do tych pól to wszystko grało po dodaniu do pliku /lib/model/Result.php jednej funkcji:
Kod
public function getDruzyna()
{
return $this->getKlub()->getKto();
}
{
return $this->getKlub()->getKto();
}
i zmianie w generatorze modułu:
Kod
...
list:
display: [ druzyna, wynik, zapisano ]
...
list:
display: [ druzyna, wynik, zapisano ]
...
Ale, gdy mam dwa odwołania do tej tej tabeli to wywala mi błąd:
Bardzo proszę o pomoc.
Pozdrawiam MolTAR