[FLOW3-general] form.select and default item

Pankaj Lele pankaj at lelesys.com
Fri Dec 30 11:30:28 CET 2011


Hello Thomas,

> I'm trying to add an empty category item on my form.select. But like it was mentioned in this old topic, the
> mapper fails because it tries to run:  $categoryRepository->findByUid(0)
> which throws an exception.
> Any idea on how to fix that?

I generally fix this in the controller itself. So you can do following
in your controller->action()

$categories = $categoryRepository->findAll()->toArray();
$categories = array_merge(array(0 => ' Default category '), $categories);
$this->view->assign('categories', $categories);

Happy new year!


-- 

With best regards,
Pankaj Lele
---------------------------

CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India

Web: http://www.lelesys.com

[Certified TYPO3 Integrator]


More information about the FLOW3-general mailing list