From c989a629d23074ca54abc9be2002304c35ae3d4d Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 4 Dec 2023 14:36:57 +0100 Subject: [PATCH] basic setup works --- composer.json | 6 ++--- config/routes.yaml | 5 ++++ config/services.yaml | 24 ++----------------- src/Controller/ApiLoginController.php | 6 ++--- src/Controller/RegistrationController.php | 4 ++-- src/Controller/SecurityController.php | 2 +- src/DependencyInjections/SptCoreExtension.php | 2 +- src/Entity/User.php | 2 +- src/SptCoreBundle.php | 4 ++-- 9 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 config/routes.yaml diff --git a/composer.json b/composer.json index ab7c62d..649029d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "spt/spt-bundle-core", - "version": "1.0.0", + "name": "spt/bundle-core", + "version": "1.0.2", "type": "symfony-bundle", "description": "Core bundle for basic functionality", "require": { @@ -12,7 +12,7 @@ }, "autoload": { "psr-4": { - "Spt\\SptCoreBundle\\": "src/" + "Spt\\CoreBundle\\": "src/" } }, "authors": [ diff --git a/config/routes.yaml b/config/routes.yaml new file mode 100644 index 0000000..d17b9ba --- /dev/null +++ b/config/routes.yaml @@ -0,0 +1,5 @@ +spt_core_bundle.routes: + prefix: 'spt-core' + type: annotation + resource: '../src/Controller/' + diff --git a/config/services.yaml b/config/services.yaml index cdebb26..a8492e8 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -6,28 +6,8 @@ services: autowire: true autoconfigure: true - Spt\SptCoreBundle\Controller\SecurityController: ~ - - # makes classes in src/ available to be used as services - # this creates a service per class whose id is the fully-qualified class name - Spt\SptCoreBundle\: - resource: '../src/' - exclude: - - '../src/DependencyInjection/' - - '../src/Entity/' - - '../src/Kernel.php' - - '../src/Tests/' - # controllers are imported separately to make sure services can be injected # as action arguments even if you don't extend any base controller class - Spt\SptCoreBundle\Controller\: + Spt\CoreBundle\Controller\: resource: '../src/Controller/' - tags: ['controller.service_arguments'] - - Spt\SptCoreBundle\Command\: - resource: '../src/Command/' - autowire: true - autoconfigure: true - arguments: [ '@doctrine.orm.entity_manager', '@service_container' ] - tags: - - { name: 'console.command' } \ No newline at end of file + tags: [ 'controller.service_arguments' ] \ No newline at end of file diff --git a/src/Controller/ApiLoginController.php b/src/Controller/ApiLoginController.php index 94bcc3b..2e7a43b 100644 --- a/src/Controller/ApiLoginController.php +++ b/src/Controller/ApiLoginController.php @@ -5,10 +5,10 @@ */ -namespace Spt\SptCoreBundle\Controller; +namespace Spt\CoreBundle\Controller; -use Spt\SptCoreBundle\Entity\User; +use Spt\CoreBundle\Entity\User; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\HttpFoundation\JsonResponse; @@ -19,7 +19,7 @@ use Symfony\Component\Security\Http\Attribute\CurrentUser; class ApiLoginController extends AbstractController { - #[Route('/api/login', name: 'spt_core_api_login', methods: ['POST'])] + #[Route('api/login', name: 'spt_core_api_login', methods: ['POST'])] public function index(Request $request): JsonResponse { $user = $this->getUser(); diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index 0a35a51..ad32197 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -5,10 +5,10 @@ */ -namespace Spt\SptCoreBundle\Controller; +namespace Spt\CoreBundle\Controller; -use Spt\SptCoreBundle\Entity\User; +use Spt\CoreBundle\Entity\User; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php index ea98933..783da8d 100644 --- a/src/Controller/SecurityController.php +++ b/src/Controller/SecurityController.php @@ -1,6 +1,6 @@