Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public function addSnippet(CodeSnippet $codeSnippet)
 {
     $codeSnippet->setUserId($this);
     $this->codeSnippets[] = $codeSnippet;
     return $this;
 }