コード例 #1
1
 /**
  * @Route("/api/equip/upgrade/category/{id}", methods={"PUT"}, requirements={"id"="^[0-9].*$"})
  * @param Request $request
  * @param EquipUpgradeCategory $equipUpgradeCategory
  * @return Response
  */
 public function updateEquipUpgradeCategoryAction(Request $request, EquipUpgradeCategory $equipUpgradeCategory)
 {
     $serializer = $this->get("jms_serializer");
     $data = $request->getContent();
     $context = new DeserializationContext();
     $context->setAttribute('target', $equipUpgradeCategory);
     $equipUpgradeCategory = $serializer->deserialize($data, 'AppBundle\\Entity\\EquipUpgradeCategory', 'json', $context);
     $em = $this->getDoctrine()->getManager();
     $em->persist($equipUpgradeCategory);
     $em->flush();
     $view = $this->view($equipUpgradeCategory, 200);
     return $this->handleView($view);
 }
コード例 #2
1
ファイル: Response.php プロジェクト: epfremmer/retrofit-php
 /**
  * Build the deserialization context
  */
 private function createContext()
 {
     $context = new DeserializationContext();
     if (!empty($this->context['groups'])) {
         $context->setGroups($this->context['groups']);
     }
     if (!empty($this->context['version'])) {
         $context->setVersion((int) $this->context['version']);
     }
     if (!empty($this->context['serializeNull'])) {
         $context->setSerializeNull((bool) $this->context['serializeNull']);
     }
     if (!empty($this->context['enableMaxDepthChecks'])) {
         $context->enableMaxDepthChecks();
     }
     if (!empty($this->context['attributes'])) {
         foreach ($this->context['attributes'] as $key => $value) {
             $context->setAttribute($key, $value);
         }
     }
     if (!empty($this->context['depth'])) {
         $contextDepth = (int) $this->context['depth'];
         while ($context->getDepth() < $contextDepth) {
             $context->increaseDepth();
         }
     }
     return $context;
 }
コード例 #3
-1
 /**
  * @Route("/api/monster/{id}", methods={"PUT"}, requirements={"id"="^[0-9].*$"})
  * @param Request $request
  * @param Monster $monster
  * @return Response
  */
 public function updateMonsterAction(Request $request, Monster $monster)
 {
     $serializer = $this->get("jms_serializer");
     $data = $request->getContent();
     $context = new DeserializationContext();
     $context->setAttribute('target', $monster);
     $monster = $serializer->deserialize($data, 'AppBundle\\Entity\\Monster', 'json', $context);
     $em = $this->getDoctrine()->getManager();
     $em->persist($monster);
     $em->flush();
     $view = $this->view($monster, 200);
     return $this->handleView($view);
 }