示例#1
0
 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('/');
 }
示例#2
0
 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);
 }