Nette\Database\Table\ActiveRow::related PHP Метод

    public function related($key, $throughColumn = NULL)
    {
        $groupedSelection = $this->table->getReferencingTable($key, $throughColumn, $this[$this->table->getPrimary()]);
        if (!$groupedSelection) {
            throw new Nette\MemberAccessException("No reference found for \${$this->table->getName()}->related({$key}).");
        }
        return $groupedSelection;
    }

Usage Example

Пример #1
0
 protected function createComponentFormTranslate($name)
 {
     $form = new Form($this, $name);
     $form->addTextArea('translate', $this->translator->trans('translate.grid.translate'));
     $form->addSubmit('send', $this->translator->trans('translate.menu.translate'));
     $form->onSuccess[] = [$this, 'submitFormTranslate'];
     $translatesLocale = $this->row->related('translate_locale')->where('language_id', $this->webLanguage)->fetch();
     if ($translatesLocale) {
         $form->setDefaults(array('translate' => $translatesLocale['translate']));
     }
     return $form;
 }
All Usage Examples Of Nette\Database\Table\ActiveRow::related