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()}"); }
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); }
public function onDeleteClaim(Event\DeleteClaimEvent $event) { $this->storage->delete($event->getClaim()); }