示例#1
0
 public function toggleQurbaniVoid($qurbanikey)
 {
     $repo = $this->qurbaniRepo->repository;
     $qurbani = $repo->find($qurbanikey);
     if ($qurbani == null) {
         throw new \Exception("Donation Could not be found");
     }
     $dummy = new Qurbani($qurbani);
     $dummy->setIsvoid($dummy->getIsvoid() == 1 ? 0 : 1);
     $errors = $this->validateRequest($dummy);
     if (count($errors) > 0) {
         throw new \Exception(implode(", ", $errors));
     }
     $this->em->transactional(function (EntityManager $em) use($qurbani) {
         $qurbani->setIsvoid($qurbani->getIsvoid() == 1 ? 0 : 1);
         $em->merge($qurbani);
     });
     return $repo->find($qurbanikey);
 }