public function createAction(Application $app, Request $request) { $memo = new Memo(); $memo->title = $request->get('title'); $memo->content = $request->get('content'); $memoDao = new MemoDao($app['db'], $app); $memoDao->insert($memo); return $app->redirect('/'); }
public function createAction(Application $app, Request $request) { // TODO use validator $memo = new Memo(); $memo->title = $request->get('title'); $memo->content = $request->get('content'); $memoDao = new MemoDao($app['db'], $app); $memo = $memoDao->insert($memo); $subRequest = Request::create($app['url_generator']->generate('api_memo', array('id' => $memo->getId(), 'created' => true)), 'GET'); return $app->handle($subRequest, HttpKernelInterface::SUB_REQUEST); }