Problem s db a cudzimi klucmi
- cujan
- Člen | 410
Caute mam v DB tabulku mineral a v nej stlpce idSkupina (cudzim klucom previazane na tab. skupina) a idVryp(cudzim klucom naviazanu na tab. vryp)
Presenter
<?
class MineralPresenter extends BasePresenter {
/**
* (non-phpDoc)
*
* @see Nette\Application\Presenter#startup()
*
*/
private $mineralRepository;
private $tasks;
protected function startup() {
parent::startup();
$this->mineralRepository = $this->context->mineralRepository;
}
public function actionDefault() {
}
public function renderDefault() {
$this->template->tasks =
$this->mineralRepository->findAllMineral();
}
}
?>\
default.latte
<?
<table>
<thead>
<tr>
<th>Minerál</th>
</tr>
</thead>
<tbody>
{foreach $tasks as $task}
<tr>
<td>{$iterator->getCounter()} </td>
<td>{$task->nazov}</td>
<td>{$task->skupina->nazov}</td>
<td>{$task->chemickeZlozenie}</td>
<td>{$task->idKrystalografickaSustava->vlastnost}</td>
<td>{$task->Vryp->nazov}</td>
<td>{$task->tvrdostOd}</td>
<td>{$task->tvrdostDo}</td>
<td>{$task->idStiepatelnost}</td>
<td>{$task->hustotaOd}</td>
<td>{$task->hustotaDo}</td>
</tr>
{/foreach}
</tbody>
</table>
?>
no a problem je v tom ze nazov skupiny mi bez problemov natiahne ale nazov vrypu nie.
Nechapem
Vdaka