* many things
This commit is contained in:
35
src/App/Handler/Album.php
Normal file
35
src/App/Handler/Album.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Handler;
|
||||
|
||||
use ApiLibs\AbstractHandler\CrudHandler;
|
||||
use App\Service\GalleryService;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
|
||||
class Album extends CrudHandler
|
||||
{
|
||||
private $galleryService;
|
||||
|
||||
public function __construct(GalleryService $galleryService)
|
||||
{
|
||||
$this->galleryService = $galleryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ServerRequestInterface $request
|
||||
* @return ResponseInterface
|
||||
* @throws \Doctrine\ORM\ORMException
|
||||
* @throws \Doctrine\ORM\OptimisticLockException
|
||||
* @throws \Doctrine\ORM\TransactionRequiredException
|
||||
*/
|
||||
public function get(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$id = (int)$request->getAttribute('id');
|
||||
return new JsonResponse($this->galleryService->getAlbum($id));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user