示例#1
0
 /**
  * @Route("/code/add", name="json-code-add")
  * @Method("POST")
  * @param Request $request
  * @return Response
  */
 public function jsonCodeAddAction(Request $request)
 {
     $code = new CodeSnippet();
     //        var_dump($request->request);
     //        exit;
     $code->setUserId($this->getUser());
     $code->setHtml($request->request->get('htmlCode'));
     $code->setCss($request->request->get('cssCode'));
     $code->setJs($request->request->get('jsCode'));
     $code->setHeading($request->request->get('heading'));
     $code->setTags($request->request->get('tags'));
     $this->get('code_manager')->saveCode($code);
 }
示例#2
0
 public function addSnippet(CodeSnippet $codeSnippet)
 {
     $codeSnippet->setUserId($this);
     $this->codeSnippets[] = $codeSnippet;
     return $this;
 }