public function init() { $element = new Select(); $element->setAttributes(['name' => 'category_id']); $element->getLabel()->setText('Категория'); $categories = $this->getServiceManager()->getEntityManager()->get('EvaCatalog\\Entity\\Category')->findAll(); $element->setOptions($categories); $this->append($element); parent::init(); }
public function init() { $element = new Select(); $element->setAttributes(['name' => 'parent']); $element->getLabel()->setText('Родительская категория'); $categories = $this->getCategoryRepository()->findAll(); $element->setOptions($categories); $element->setEmptyOption(''); $this->set('parent', $element); parent::init(); $this->remove('url'); }