Exemplo n.º 1
0
 public function __invoke(ServerRequestInterface $request)
 {
     /** @var \asylgrp\workbench\Domain\Contact $contact */
     $contact = $this->storage->read($this->validateId($request->getAttribute('id')));
     $this->dispatcher->dispatch(Event\DeleteContactEvent::CLASS, new Event\DeleteContactEvent($contact));
     return $this->responder->createResponse(new Responder\Payload([]))->addSuccessMessage("Tog bort {$contact->getName()}.\nOBS! Registrerade ansökningar togs ej bort!");
 }
 public function createResponse(Payload $payload)
 {
     $envelope = $this->resourceFactory->createContactCollectionResource();
     foreach ($this->contactStorage->readAll() as $contact) {
         $envelope->addResource('contact-collection', $this->resourceFactory->createContactResource($contact));
     }
     return new Hal\Response($envelope);
 }
 public function onDeleteContact(Event\DeleteContactEvent $event)
 {
     $this->storage->delete($event->getContact());
 }