Is it possible to access controller plugins from a form/controller factory (any factory implementing FactoryInterface)?
I have a form factory that i want to set the form action depending on the request parameter, but need to access the url from the route defined in config.
So whereas in a controller i would use the url controller plugin:
$form->setAttribute('action', $this->url()->fromRoute('appointment.add', array('clientId' => $clientId)));
...how can i access this in a factory? eg something like:
class MyFormFactory implements FactoryInterface
{
public function createService(ServiceLocatorInterface $serviceLocator){
$serviceManager = $serviceLocator->getServiceLocator();
//...snip...
$form = new AddAppointmentForm($client);
$serviceManager->get('ControllerPluginManager');
$url = $controllerPluginManager->get('Url');
die($url->fromRoute('appointment.add', ['clientId' => $clientId]));
return $form;
}