コード例 #1
0
 public function __invoke(ServerRequestInterface $request)
 {
     /** @var \asylgrp\workbench\Domain\Claim $claim */
     $claim = $this->storage->read($this->validateId($request->getAttribute('id')));
     $this->dispatcher->dispatch(Event\DeleteClaimEvent::CLASS, new Event\DeleteClaimEvent($claim));
     return $this->responder->createResponse(new Responder\Payload([]))->addSuccessMessage("Tog bort ansökan på {$claim->getRequestedAmount()} kr från {$claim->getContact()->getName()}");
 }
コード例 #2
0
 public function createResponse(Payload $payload)
 {
     $envelope = $this->resourceFactory->createClaimCollectionResource();
     foreach ($this->claimStorage->readAll() as $claim) {
         $envelope->addResource('claim-collection', $this->resourceFactory->createClaimResource($claim));
     }
     return new Hal\Response($envelope);
 }
コード例 #3
0
 public function onDeleteClaim(Event\DeleteClaimEvent $event)
 {
     $this->storage->delete($event->getClaim());
 }