Пример #1
0
 /**
  * @param $id
  * @throws \Model\RecordNotFoundException
  */
 public function load($id)
 {
     $section = $this->sectionFilter->filterId($this->sectionFacade->all(), $id)->fetch();
     if (!$section) {
         throw new RecordNotFoundException("Section with ID {$id} does not exists!");
     }
     $this->id = $id;
     $typeCodes = array_keys($this->sectionFacade->getMenuType($id)->fetchPairs('code'));
     $form = $this['form'];
     $form['base']->setDefaults($section->toArray());
     $form['type']['menu_type_code']->setDefaultValue($typeCodes);
 }
 /**
  * @param int $id
  * @return array
  */
 public function getOptionsBySection($id)
 {
     return $this->sectionFacade->getMenuType($id)->select('menu_type.name, menu_type.code')->order('name')->fetchPairs('code', 'name');
 }