diff --git a/composer.json b/composer.json index 4198b91a5d8bfd05c473a6e9d0d8de5d454821f9..5932a93959989bfb928f6f3a2b4a8e1d40ccab9a 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "dbp/relay-template-bundle", - "description": "A template bundle for the Relay API gateway", + "name": "dbp/relay-example-bundle", + "description": "An example bundle for the Relay API gateway", "type": "symfony-bundle", "license": "AGPL-3.0-or-later", "require": { @@ -23,12 +23,12 @@ }, "autoload": { "psr-4": { - "Dbp\\Relay\\TemplateBundle\\": "src/" + "Dbp\\Relay\\ExampleBundle\\": "src/" } }, "autoload-dev": { "psr-4": { - "Dbp\\Relay\\TemplateBundle\\Tests\\": "tests/" + "Dbp\\Relay\\ExampleBundle\\Tests\\": "tests/" } }, "config": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ff463f690ff0aff49461e5459cd5c36dee45e886..99d85aad2bd90c142c6e9fa84344b154320c0db4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,7 +12,7 @@ <server name="APP_ENV" value="test" force="true"/> <server name="SHELL_VERBOSITY" value="-1"/> <server name="SYMFONY_DEPRECATIONS_HELPER" value='max[direct]=0&quiet[]=indirect'/> - <server name="KERNEL_CLASS" value="Dbp\Relay\TemplateBundle\Tests\Kernel"/> + <server name="KERNEL_CLASS" value="Dbp\Relay\ExampleBundle\Tests\Kernel"/> </php> <testsuites> <testsuite name="Project Test Suite"> diff --git a/src/Command/TestCommand.php b/src/Command/TestCommand.php index 87f017269ea95db95f5b772542404a7bbe10d4be..8d9005be5519d01f0d0406d95c134bd9f562a0e1 100644 --- a/src/Command/TestCommand.php +++ b/src/Command/TestCommand.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Command; +namespace Dbp\Relay\ExampleBundle\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; diff --git a/src/Controller/LoggedInOnly.php b/src/Controller/LoggedInOnly.php index 16aee9cad7820f56438514b2a72f2782ccb527bb..7cfe4bd8bf59fa6c05503cfe89f1b6db9c7bf407 100644 --- a/src/Controller/LoggedInOnly.php +++ b/src/Controller/LoggedInOnly.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Controller; +namespace Dbp\Relay\ExampleBundle\Controller; -use Dbp\Relay\TemplateBundle\Entity\Place; +use Dbp\Relay\ExampleBundle\Entity\Place; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; diff --git a/src/DataPersister/PlaceDataPersister.php b/src/DataPersister/PlaceDataPersister.php index bec4060bdeaf343cbac30d2d9d05f5110212f573..8b90ff7a01c56046331c147a65a981363fbf0d2d 100644 --- a/src/DataPersister/PlaceDataPersister.php +++ b/src/DataPersister/PlaceDataPersister.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\DataPersister; +namespace Dbp\Relay\ExampleBundle\DataPersister; use ApiPlatform\Core\DataPersister\DataPersisterInterface; -use Dbp\Relay\TemplateBundle\Entity\Place; -use Dbp\Relay\TemplateBundle\Service\PlaceProviderInterface; +use Dbp\Relay\ExampleBundle\Entity\Place; +use Dbp\Relay\ExampleBundle\Service\PlaceProviderInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; class PlaceDataPersister extends AbstractController implements DataPersisterInterface diff --git a/src/DataProvider/PlaceCollectionDataProvider.php b/src/DataProvider/PlaceCollectionDataProvider.php index b89deee5414779efd588de4ab47ce69e539947cf..a2537c7691c504f5094827116e5d826d59ee024f 100644 --- a/src/DataProvider/PlaceCollectionDataProvider.php +++ b/src/DataProvider/PlaceCollectionDataProvider.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\DataProvider; +namespace Dbp\Relay\ExampleBundle\DataProvider; use ApiPlatform\Core\DataProvider\CollectionDataProviderInterface; use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface; use Dbp\Relay\CoreBundle\Helpers\ArrayFullPaginator; -use Dbp\Relay\TemplateBundle\Entity\Place; -use Dbp\Relay\TemplateBundle\Service\PlaceProviderInterface; +use Dbp\Relay\ExampleBundle\Entity\Place; +use Dbp\Relay\ExampleBundle\Service\PlaceProviderInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; final class PlaceCollectionDataProvider extends AbstractController implements CollectionDataProviderInterface, RestrictedDataProviderInterface diff --git a/src/DataProvider/PlaceItemDataProvider.php b/src/DataProvider/PlaceItemDataProvider.php index bba02e192e671a02659882330ea51618678942cf..dd0d633bf25e723cb7daa6f36a8beb3a839aba0f 100644 --- a/src/DataProvider/PlaceItemDataProvider.php +++ b/src/DataProvider/PlaceItemDataProvider.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\DataProvider; +namespace Dbp\Relay\ExampleBundle\DataProvider; use ApiPlatform\Core\DataProvider\ItemDataProviderInterface; use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface; -use Dbp\Relay\TemplateBundle\Entity\Place; -use Dbp\Relay\TemplateBundle\Service\PlaceProviderInterface; +use Dbp\Relay\ExampleBundle\Entity\Place; +use Dbp\Relay\ExampleBundle\Service\PlaceProviderInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; final class PlaceItemDataProvider extends AbstractController implements ItemDataProviderInterface, RestrictedDataProviderInterface diff --git a/src/DbpRelayTemplateBundle.php b/src/DbpRelayExampleBundle.php similarity index 72% rename from src/DbpRelayTemplateBundle.php rename to src/DbpRelayExampleBundle.php index e040da739dc6ff16c7fdf48812ea48a36b264d30..823295f1251d03c316e4d27864acbc10d0e426d3 100644 --- a/src/DbpRelayTemplateBundle.php +++ b/src/DbpRelayExampleBundle.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle; +namespace Dbp\Relay\ExampleBundle; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; -class DbpRelayTemplateBundle extends Bundle +class DbpRelayExampleBundle extends Bundle { public function build(ContainerBuilder $container) { diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 86353cb001593a56f9f9fead26e9260e43e1cc51..9a931b474d180d8ff027696329da7622bc02bec5 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\DependencyInjection; +namespace Dbp\Relay\ExampleBundle\DependencyInjection; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; diff --git a/src/DependencyInjection/DbpRelayTemplateExtension.php b/src/DependencyInjection/DbpRelayTemplateExtension.php index 93d457ad6534dda3793ac53de675a5235dfea1c6..842ceb879c3f2d886d7c8aeaa6e2fd8956601c12 100644 --- a/src/DependencyInjection/DbpRelayTemplateExtension.php +++ b/src/DependencyInjection/DbpRelayTemplateExtension.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\DependencyInjection; +namespace Dbp\Relay\ExampleBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension; -class DbpRelayTemplateExtension extends ConfigurableExtension +class DbpRelayExampleExtension extends ConfigurableExtension { public function loadInternal(array $mergedConfig, ContainerBuilder $container) { @@ -23,7 +23,7 @@ class DbpRelayTemplateExtension extends ConfigurableExtension $loader->load('services.yaml'); // Inject the config value into the MyCustomService service - $definition = $container->getDefinition('Dbp\Relay\TemplateBundle\Service\MyCustomService'); + $definition = $container->getDefinition('Dbp\Relay\ExampleBundle\Service\MyCustomService'); $definition->addArgument($mergedConfig['example_config']); } diff --git a/src/Entity/Place.php b/src/Entity/Place.php index 1efa7c0c702dad77d4be174d62bfc69fe6613877..0b18ad8939c372118a544be8526bbdf627317512 100644 --- a/src/Entity/Place.php +++ b/src/Entity/Place.php @@ -2,61 +2,61 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Entity; +namespace Dbp\Relay\ExampleBundle\Entity; use ApiPlatform\Core\Annotation\ApiProperty; use ApiPlatform\Core\Annotation\ApiResource; -use Dbp\Relay\TemplateBundle\Controller\LoggedInOnly; +use Dbp\Relay\ExampleBundle\Controller\LoggedInOnly; use Symfony\Component\Serializer\Annotation\Groups; /** * @ApiResource( * collectionOperations={ * "get" = { - * "path" = "/template/places", + * "path" = "/example/places", * "openapi_context" = { - * "tags" = {"Template"}, + * "tags" = {"Example"}, * }, * } * }, * itemOperations={ * "get" = { - * "path" = "/template/places/{identifier}", + * "path" = "/example/places/{identifier}", * "openapi_context" = { - * "tags" = {"Template"}, + * "tags" = {"Example"}, * }, * }, * "put" = { - * "path" = "/template/places/{identifier}", + * "path" = "/example/places/{identifier}", * "openapi_context" = { - * "tags" = {"Template"}, + * "tags" = {"Example"}, * }, * }, * "delete" = { - * "path" = "/template/places/{identifier}", + * "path" = "/example/places/{identifier}", * "openapi_context" = { - * "tags" = {"Template"}, + * "tags" = {"Example"}, * }, * }, * "loggedin_only" = { * "security" = "is_granted('IS_AUTHENTICATED_FULLY')", * "method" = "GET", - * "path" = "/template/places/{identifier}/loggedin-only", + * "path" = "/example/places/{identifier}/loggedin-only", * "controller" = LoggedInOnly::class, * "openapi_context" = { * "summary" = "Only works when logged in.", - * "tags" = {"Template"}, + * "tags" = {"Example"}, * }, * } * }, * iri="https://schema.org/Place", - * shortName="TemplatePlace", + * shortName="ExamplePlace", * normalizationContext={ - * "groups" = {"TemplatePlace:output"}, + * "groups" = {"ExamplePlace:output"}, * "jsonld_embed_context" = true * }, * denormalizationContext={ - * "groups" = {"TemplatePlace:input"}, + * "groups" = {"ExamplePlace:input"}, * "jsonld_embed_context" = true * } * ) @@ -70,7 +70,7 @@ class Place /** * @ApiProperty(iri="https://schema.org/name") - * @Groups({"TemplatePlace:output", "TemplatePlace:input"}) + * @Groups({"ExamplePlace:output", "ExamplePlace:input"}) * * @var string */ diff --git a/src/Resources/config/services.yaml b/src/Resources/config/services.yaml index 9e9466bb024477680643d45dbc0535521a9742bb..3ed85194f647c8766c6b8658959400f339be2003 100644 --- a/src/Resources/config/services.yaml +++ b/src/Resources/config/services.yaml @@ -1,30 +1,30 @@ services: - Dbp\Relay\TemplateBundle\Command\TestCommand: + Dbp\Relay\ExampleBundle\Command\TestCommand: autowire: true autoconfigure: true - Dbp\Relay\TemplateBundle\Controller\: + Dbp\Relay\ExampleBundle\Controller\: resource: '../../Controller' autoconfigure: true autowire: true - Dbp\Relay\TemplateBundle\DataPersister\: + Dbp\Relay\ExampleBundle\DataPersister\: resource: '../../DataPersister' autowire: true autoconfigure: true - Dbp\Relay\TemplateBundle\DataProvider\: + Dbp\Relay\ExampleBundle\DataProvider\: resource: '../../DataProvider' autowire: true autoconfigure: true - Dbp\Relay\TemplateBundle\Service\ExternalApi: + Dbp\Relay\ExampleBundle\Service\ExternalApi: autowire: true autoconfigure: true - Dbp\Relay\TemplateBundle\Service\MyCustomService: + Dbp\Relay\ExampleBundle\Service\MyCustomService: autowire: true autoconfigure: true - Dbp\Relay\TemplateBundle\Service\PlaceProviderInterface: - '@Dbp\Relay\TemplateBundle\Service\ExternalApi' + Dbp\Relay\ExampleBundle\Service\PlaceProviderInterface: + '@Dbp\Relay\ExampleBundle\Service\ExternalApi' diff --git a/src/Service/ExternalApi.php b/src/Service/ExternalApi.php index c7e0f0fa4a66d11a479525fdf33e8e02483b7e72..791213a1073d290274a919538cabe164240ad5fc 100644 --- a/src/Service/ExternalApi.php +++ b/src/Service/ExternalApi.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Service; +namespace Dbp\Relay\ExampleBundle\Service; -use Dbp\Relay\TemplateBundle\Entity\Place; +use Dbp\Relay\ExampleBundle\Entity\Place; class ExternalApi implements PlaceProviderInterface { diff --git a/src/Service/MyCustomService.php b/src/Service/MyCustomService.php index b1817b0ab465a40bb9d1694214cfc5cea8871a3e..b18fd5c56e67e9bddae0c9873c27a75e7683573b 100644 --- a/src/Service/MyCustomService.php +++ b/src/Service/MyCustomService.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Service; +namespace Dbp\Relay\ExampleBundle\Service; class MyCustomService { diff --git a/src/Service/PlaceProviderInterface.php b/src/Service/PlaceProviderInterface.php index dc0339998df6ca0b3b4c791d3dd45e0571658fb4..e7a25c9744abb9b5288a4fbac929c5aebcaa4359 100644 --- a/src/Service/PlaceProviderInterface.php +++ b/src/Service/PlaceProviderInterface.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Service; +namespace Dbp\Relay\ExampleBundle\Service; -use Dbp\Relay\TemplateBundle\Entity\Place; +use Dbp\Relay\ExampleBundle\Entity\Place; interface PlaceProviderInterface { diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 1cee1bf49894cf5f0c2c7efe7fc164ab3325b0eb..957a1ac452d4bd123dba096276c0700745a88576 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Tests; +namespace Dbp\Relay\ExampleBundle\Tests; use ApiPlatform\Core\Bridge\Symfony\Bundle\Test\ApiTestCase; use Symfony\Component\HttpFoundation\Response; @@ -12,16 +12,16 @@ class ApiTest extends ApiTestCase public function testBasics() { $client = self::createClient(); - $response = $client->request('GET', '/template/places'); + $response = $client->request('GET', '/example/places'); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); - $response = $client->request('GET', '/template/places/graz'); + $response = $client->request('GET', '/example/places/graz'); $this->assertSame(Response::HTTP_OK, $response->getStatusCode()); - $response = $client->request('DELETE', '/template/places/graz'); + $response = $client->request('DELETE', '/example/places/graz'); $this->assertSame(Response::HTTP_NO_CONTENT, $response->getStatusCode()); - $response = $client->request('PUT', '/template/places/graz', [ + $response = $client->request('PUT', '/example/places/graz', [ 'headers' => [ 'Content-Type' => 'application/json', ], @@ -34,7 +34,7 @@ class ApiTest extends ApiTestCase public function testNoAuth() { $client = self::createClient(); - $response = $client->request('GET', '/template/places/graz/loggedin-only'); + $response = $client->request('GET', '/example/places/graz/loggedin-only'); $this->assertSame(Response::HTTP_UNAUTHORIZED, $response->getStatusCode()); } } diff --git a/tests/Kernel.php b/tests/Kernel.php index d3ee50e2f82c993d372ce44589b32b84325aaa1a..7c51a36a6cacf9001ac1fe10bf510a32ef41c3b9 100644 --- a/tests/Kernel.php +++ b/tests/Kernel.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Tests; +namespace Dbp\Relay\ExampleBundle\Tests; use ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle; use Dbp\Relay\CoreBundle\DbpRelayCoreBundle; -use Dbp\Relay\TemplateBundle\DbpRelayTemplateBundle; +use Dbp\Relay\ExampleBundle\DbpRelayExampleBundle; use Nelmio\CorsBundle\NelmioCorsBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; @@ -30,7 +30,7 @@ class Kernel extends BaseKernel yield new NelmioCorsBundle(); yield new MonologBundle(); yield new ApiPlatformBundle(); - yield new DbpRelayTemplateBundle(); + yield new DbpRelayExampleBundle(); yield new DbpRelayCoreBundle(); } diff --git a/tests/Service/ExternalApiTest.php b/tests/Service/ExternalApiTest.php index 68211e5362fed06a718f1b468473170083261e6d..ad2228545ec0960dc98240a7f1d28d9cb56b8c51 100644 --- a/tests/Service/ExternalApiTest.php +++ b/tests/Service/ExternalApiTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Dbp\Relay\TemplateBundle\Tests\Service; +namespace Dbp\Relay\ExampleBundle\Tests\Service; -use Dbp\Relay\TemplateBundle\Service\ExternalApi; -use Dbp\Relay\TemplateBundle\Service\MyCustomService; +use Dbp\Relay\ExampleBundle\Service\ExternalApi; +use Dbp\Relay\ExampleBundle\Service\MyCustomService; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class ExternalApiTest extends WebTestCase