Ejemplo n.º 1
0
 /**
  * @param $location_id
  * @param array $resources
  * @return \Symfony\Component\HttpFoundation\JsonResponse
  */
 public function storeLocation($location_id, array $resources)
 {
     $location = $this->em->find('riki34GameBundle:Location', $location_id);
     $this->jsonLoader->storeFile($location->getFile(), $resources);
     $message = "Location saved";
     return $this->response->generateSuccessResponse(array($message));
 }
Ejemplo n.º 2
0
 public function addChar($data)
 {
     $fraction = $this->em->find('riki34GameBundle:Fraction', $data['fractionID']);
     $specialization = $this->em->find('riki34GameBundle:Specialization', $data['specializationID']);
     $char = new PlayerChar($fraction, $specialization);
     $char->setName($data['name']);
     $char->setSex($data['sex']);
     $char->setUser($this->user);
     $errors = $this->validator->validate($char, null, array('create'));
     if (count($errors) === 0) {
         $bag = new Bag();
         $bag->setChar($char);
         $this->em->persist($bag);
         $this->em->persist($char);
         $this->em->flush();
         return $this->response->generateSuccessResponse();
     } else {
         return $this->response->generateErrorResponse($errors);
     }
 }