I have a form in a CMS zf2 application with a standard selection list populated by a service and a form element also populated by a service, the form is set using the factory call in Module.php:
public function getServiceConfig() { return array( 'factories' => array( 'ElmContent\Form\WebpageForm' => function ($sm) { $service1 = $sm->get('parentPagesService'); $service2 = $sm->get('categoryService'); $form = new Form\WebpageForm; $form->setService($service1, $service2); return $form; },
The Category Service is used to fill out my form element (a list of categories from another table) - if I edit a page in my CMS, then when I create a list of categories, I want to link to another table and see which ones were connected, for this I you need to pass the page id from the URL, for example:
http: //cms.local/pages/edit/100 , where 100 is the page identifier, and then can be passed to the Service category:
$this->getCategoryAssociationsTable()->findByPageId(100);
If necessary, additional code can be provided, but in essence, 2 form elements are filled with data from db tables, so I configure using the factory call, the second element is a formatted list of flags, and I want to set them as checked when editing, if they were previously selected. To do this, I need to pass pageId from the URL, but I canβt figure out where to do this when setting up the form the way I do. Thanks in advance.
ed103 source share