Skip to content
Snippets Groups Projects
Commit 7438808a authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Add more migrations from "template" to "example"

parent 63813877
No related branches found
No related tags found
No related merge requests found
Pipeline #105952 failed
Showing
with 64 additions and 64 deletions
{
"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": {
......
......@@ -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&amp;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">
......
......@@ -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;
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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']);
}
......
......@@ -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
*/
......
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'
......@@ -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
{
......
......@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Dbp\Relay\TemplateBundle\Service;
namespace Dbp\Relay\ExampleBundle\Service;
class MyCustomService
{
......
......@@ -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
{
......
......@@ -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());
}
}
......@@ -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();
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment