Substituted interface through abstract methods to allow the use of services

This commit is contained in:
Kevin Frantz 2019-01-06 18:56:04 +01:00
parent a631475254
commit 14392c22f0
3 changed files with 38 additions and 2 deletions

View File

@ -8,7 +8,7 @@ use Symfony\Component\HttpFoundation\Response;
/**
* @author kevinfrantz
*/
interface APIControllerInterface extends CRUDControllerInterface
interface APIControllerInterface
{
/**
* @param Request $request HTTP Method GET with filtering parameters

View File

@ -3,10 +3,44 @@
namespace App\Controller\API;
use App\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
/**
* @author kevinfrantz
* @see https://de.wikipedia.org/wiki/CRUD
*/
abstract class AbstractAPIController extends AbstractController implements APIControllerInterface
{
/**
* @param Request $request HTTP Method POST with the object attributes as parameters
*
* @return Response
*/
abstract public function create(Request $request): Response;
/**
* @param Request $request HTTP Method GET
* @param int|string $identifier The slug or id of the object
*
* @return Response
*/
abstract public function read(Request $request, $identifier): Response;
/**
* @param Request $request HTTP Method PUT
* @param int|string $identifier The slug or id of the object
*
* @return Response
*/
abstract public function update(Request $request, $identifier): Response;
/**
* @param Request $request HTTP Method DELETE with the object attributes as parameters
* @param int|string $identifier The slug or id of the object
*
* @return Response
*/
abstract public function delete(Request $request, $identifier): Response;
}

View File

@ -6,8 +6,10 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
/**
* Moved functions to
* @see AbstractAPIController
* @author kevinfrantz
*
* @deprecated Feel free to delete this interface!
* @see https://de.wikipedia.org/wiki/CRUD
*/
interface CRUDControllerInterface