Skip to content

Commit

Permalink
Move the blob dummy entity into the blob subdir as well
Browse files Browse the repository at this point in the history
and adjust the doctrine config, since that needs at least one "entity"
to work, even if it's not used.

and port to PHP attributes
  • Loading branch information
lazka committed Sep 24, 2024
1 parent 84cf995 commit f05548c
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 64 deletions.
79 changes: 79 additions & 0 deletions src/Blob/Dummy.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

declare(strict_types=1);

namespace Dbp\Relay\CabinetBundle\Blob;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;

#[ApiResource(
shortName: 'cabinet',
types: ['https://schema.org/DigitalDocument'],
operations: [
new Get(
uriTemplate: '/signature',
controller: BlobSignatureController::class,
openapiContext: [
'tags' => ['Cabinet'],
'summary' => 'Returns a signed blob url which can be used to do operations on blob',
'parameters' => [
[
'name' => 'method',
'in' => 'query',
'description' => 'Blob method which will be used',
'type' => 'string',
'required' => true,
'example' => 'GET',
],
[
'name' => 'type',
'in' => 'query',
'description' => 'Blob type which will be stored',
'type' => 'string',
'required' => false,
'example' => '',
],
[
'name' => 'prefix',
'in' => 'query',
'description' => 'Prefix to be stored for the blob resource',
'type' => 'string',
'required' => false,
'example' => '',
],
[
'name' => 'identifier',
'in' => 'query',
'description' => 'Identifier of the blob resource',
'type' => 'string',
'required' => false,
'example' => '',
],
[
'name' => 'includeData',
'in' => 'query',
'description' => '1 if GET request should return base64 encoded filedata, not given otherwise',
'type' => 'string',
'required' => false,
'example' => '',
],
],
],
normalizationContext: [
'groups' => ['Cabinet:output'],
'jsonld_embed_context' => true,
],
read: false,
name: 'signature'
),
],
routePrefix: '/cabinet',
normalizationContext: [
'groups' => ['Cabinet:output'],
'jsonld_embed_context' => true,
]
)]
class Dummy
{
}
6 changes: 4 additions & 2 deletions src/DependencyInjection/DbpRelayCabinetExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class DbpRelayCabinetExtension extends ConfigurableExtension implements PrependE

public function loadInternal(array $mergedConfig, ContainerBuilder $container): void
{
$this->addResourceClassDirectory($container, __DIR__.'/../Blob');

$pathsToHide = [
'/cabinet/typesense',
];
Expand Down Expand Up @@ -73,8 +75,8 @@ public function prepend(ContainerBuilder $container): void
'mappings' => [
'dbp_relay_cabinet' => [
'type' => 'attribute',
'dir' => __DIR__.'/../Entity',
'prefix' => 'Dbp\Relay\CabinetBundle\Entity',
'dir' => __DIR__.'/../Blob',
'prefix' => 'Dbp\Relay\CabinetBundle\Blob',
],
],
],
Expand Down
9 changes: 0 additions & 9 deletions src/Entity/Dummy.php

This file was deleted.

53 changes: 0 additions & 53 deletions src/Resources/config/api_resources.yaml

This file was deleted.

0 comments on commit f05548c

Please sign in to comment.