/** * */ public function putArticleAction(Article $article, Request $request) { // yes we replace totally the old article by a new one // except the id, because that's how PUT works // if you just want to "merge" you want to use PATCH, not PUT $id = $article->getId(); $article = new Article(); $article->setId($id); $errors = $this->treatAndValidateRequest($article, $request); if (count($errors) > 0) { return new View($errors, Response::HTTP_UNPROCESSABLE_ENTITY); } $this->persistAndFlush($article); return ""; }
/** * {@inheritDoc} */ public function setId($id) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setId', array($id)); return parent::setId($id); }