public function createAction() { if ($this->getRequest()->isPost()) { $this->dashboardForm->setData($this->getRequest()->getPost()); if ($this->dashboardForm->isValid()) { $data = $this->dashboardForm->getData(); $this->dashboardTaskService->persistFromArray($data); return $this->redirect()->toRoute('dashboard/manage'); } } return new ViewModel(['dashboardForm' => $this->dashboardForm]); }
public function create($data) { $dashboard = $this->dashboardTaskService->persistFromArray((array) $data); return new DashboardEntity($dashboard); }