Skip to content
Snippets Groups Projects
Commit c05a5f05 authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

Remove person code and rename to relay-base-organization-bundle

parent c92db122
No related branches found
No related tags found
No related merge requests found
Pipeline #58182 passed
Showing
with 267 additions and 461 deletions
# DbpRelayBaseBundle # DbpRelayBaseOrganizationBundle
[GitLab](https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-bundle) | [Packagist](https://packagist.org/packages/dbp/relay-base-bundle) [GitLab](https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-organization-bundle) | [Packagist](https://packagist.org/packages/dbp/relay-base-organization-bundle)
This Symfony bundle contains entities required by many bundles for the DBP Relay project.
## Integration into the Relay API Server
* Add the bundle package as a dependency:
```
composer require dbp/relay-base-bundle
```
* Add the bundle to your `config/bundles.php` in front of `DbpRelayCoreBundle`:
```php
...
Dbp\Relay\BaseBundle\DbpRelayBaseBundle::class => ['all' => true],
Dbp\Relay\CoreBundle\DbpRelayCoreBundle => ['all' => true],
];
```
* Run `composer install` to clear caches
## PersonProvider service
For this bundle to work you need to create a service that implements
[PersonProviderInterface](https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-bundle/-/blob/main/src/API/PersonProviderInterface.php)
in your application.
### Example
#### Service class
You can for example put below code into `src/Service/PersonProvider.php`:
```php
<?php
declare(strict_types=1);
namespace YourUniversity\Service;
use Dbp\Relay\BaseBundle\API\PersonProviderInterface;
use Dbp\Relay\BaseBundle\Entity\Person;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
class PersonProvider implements PersonProviderInterface
{
/**
* @param array $filters $filters['search'] can be a string to search for people (e.g. part of the name)
* @return Person[]
*/
public function getPersons(array $filters): array
{
$people = some_method_to_fetch_persons($filters);
return $people;
}
public function getPersonsByNameAndBirthDate(string $givenName, string $familyName, string $birthDate): array
{
$people = some_method_to_fetch_persons_by_name_and_birthday($givenName, $familyName, $birthDate);
return $people;
}
public function getPerson(string $id): Person
{
return some_method_to_fetch_person_by_id($id);
}
/**
* This is only used by external services (e.g. the alma bundle) to translate external persons to internal persons
*
* @param string $service identifies the service that wants to fetch a person
* @param string $serviceID identifies person by an external id
* @return Person
*/
public function getPersonForExternalService(string $service, string $serviceID): Person
{
switch($service) {
case "some-service":
return some_method_to_fetch_person_from_external_service($serviceID);
break;
default:
throw new BadRequestHttpException("Unknown service: $service");
}
}
/**
* Returns the Person matching the current user. Or null if there is no associated person
* like when the client is another server.
*/
public function getCurrentPerson(): ?Person
{
return some_method_to_fetch_current_person();
}
}
```
#### Services configuration
For above class you need to add this to your `src/Resources/config/services.yaml`:
```yaml
Dbp\Relay\BaseBundle\API\PersonProviderInterface:
'@YourUniversity\Service\PersonProvider'
```
## OrganizationProvider service
For services that need to fetch organizations you need to create a service that implements
[OrganizationProviderInterface](https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-bundle/-/blob/main/src/API/OrganizationProviderInterface.php)
in your application.
### Example
#### Service class
You can for example put below code into `src/Service/OrganizationProvider.php`:
```php
<?php
declare(strict_types=1);
namespace YourUniversity\Service;
use Dbp\Relay\BaseBundle\API\OrganizationProviderInterface;
use Dbp\Relay\BaseBundle\Entity\Organization;
class OrganizationProvider implements OrganizationProviderInterface
{
public function getOrganizationById(string $identifier, string $lang): Organization
{
return some_method_that_fetches_an_organization_by_id($identifier, $lang);
}
/**
* @return Organization[]
*/
public function getOrganizationsByPerson(Person $person, string $context, string $lang): array
{
return some_method_that_fetches_an_organization_by_person($person, $context, $lang);
}
/**
* @return Organization[]
*/
public function getOrganizations(string $lang): array
{
return some_method_that_fetches_all_organizations($lang);
}
}
```
#### Services configuration
For above class you need to add this to your `src/Resources/config/services.yaml`:
```yaml
Dbp\Relay\BaseBundle\API\OrganizationProviderInterface:
'@YourUniversity\Service\OrganizationProvider'
```
{ {
"name": "dbp/relay-base-bundle", "name": "dbp/relay-base-organization-bundle",
"type": "symfony-bundle", "type": "symfony-bundle",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"require": { "require": {
"php": "^7.3", "php": "^7.3",
"ext-json": "*", "ext-json": "*",
"api-platform/core": "^2.6.3", "api-platform/core": "^2.6.3",
"dbp/relay-base-person-bundle": "^0.1.3",
"dbp/relay-core-bundle": "^0.1.11", "dbp/relay-core-bundle": "^0.1.11",
"guzzlehttp/guzzle": "^7.0", "guzzlehttp/guzzle": "^7.0",
"nelmio/cors-bundle": "^2.1.0", "nelmio/cors-bundle": "^2.1.0",
...@@ -32,12 +33,12 @@ ...@@ -32,12 +33,12 @@
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Dbp\\Relay\\BaseBundle\\": "src/" "Dbp\\Relay\\BaseOrganizationBundle\\": "src/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Dbp\\Relay\\BaseBundle\\Tests\\": "tests/" "Dbp\\Relay\\BaseOrganizationBundle\\Tests\\": "tests/"
} }
}, },
"config": { "config": {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "412a6debb11df123e57bd8a615074b4b", "content-hash": "4931b2b2c0918a53773c99da81a7ce0b",
"packages": [ "packages": [
{ {
"name": "api-platform/core", "name": "api-platform/core",
...@@ -166,13 +166,61 @@ ...@@ -166,13 +166,61 @@
], ],
"time": "2021-09-29T19:11:04+00:00" "time": "2021-09-29T19:11:04+00:00"
}, },
{
"name": "dbp/relay-base-person-bundle",
"version": "v0.1.3",
"source": {
"type": "git",
"url": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-base-person-bundle",
"reference": "f7a234362d9d11d2897b7218e1d94cb1ad153f82"
},
"require": {
"api-platform/core": "^2.6.3",
"dbp/relay-core-bundle": "^0.1.11",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.0",
"nelmio/cors-bundle": "^2.1.0",
"php": "^7.3",
"phpdocumentor/reflection-docblock": "^3.0 || ^4.0 || ^5.0",
"symfony/config": "^5.2",
"symfony/expression-language": "^5.2",
"symfony/framework-bundle": "^5.2",
"symfony/security-bundle": "^5.2",
"symfony/security-core": "^5.2",
"symfony/security-guard": "^5.2",
"symfony/twig-bundle": "^5.2",
"symfony/validator": "^5.2",
"symfony/yaml": "^5.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "^0.12.33",
"phpstan/phpstan-phpunit": "^0.12.13",
"symfony/browser-kit": "^5.2",
"symfony/http-client": "^5.2",
"symfony/monolog-bundle": "^3.7",
"symfony/phpunit-bridge": "^5.2",
"vimeo/psalm": "^4.4"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"Dbp\\Relay\\BasePersonBundle\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"AGPL-3.0-or-later"
],
"time": "2021-10-21T12:26:36+00:00"
},
{ {
"name": "dbp/relay-core-bundle", "name": "dbp/relay-core-bundle",
"version": "v0.1.16", "version": "v0.1.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-core-bundle", "url": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-core-bundle",
"reference": "3c049f19af4bdf0fc3d0c40765deb4da2c169585" "reference": "86a52bf2dbcdd1258d38208871ac009d924d6396"
}, },
"require": { "require": {
"api-platform/core": "^2.6.3", "api-platform/core": "^2.6.3",
...@@ -227,7 +275,7 @@ ...@@ -227,7 +275,7 @@
"license": [ "license": [
"AGPL-3.0-or-later" "AGPL-3.0-or-later"
], ],
"time": "2021-09-13T08:02:44+00:00" "time": "2021-10-20T08:28:56+00:00"
}, },
{ {
"name": "doctrine/annotations", "name": "doctrine/annotations",
...@@ -600,24 +648,25 @@ ...@@ -600,24 +648,25 @@
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "7.3.0", "version": "7.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "7008573787b430c1c1f650e3722d9bba59967628" "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/7008573787b430c1c1f650e3722d9bba59967628", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/868b3571a039f0ebc11ac8f344f4080babe2cb94",
"reference": "7008573787b430c1c1f650e3722d9bba59967628", "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-json": "*",
"guzzlehttp/promises": "^1.4", "guzzlehttp/promises": "^1.5",
"guzzlehttp/psr7": "^1.7 || ^2.0", "guzzlehttp/psr7": "^1.8.3 || ^2.1",
"php": "^7.2.5 || ^8.0", "php": "^7.2.5 || ^8.0",
"psr/http-client": "^1.0" "psr/http-client": "^1.0",
"symfony/deprecation-contracts": "^2.2"
}, },
"provide": { "provide": {
"psr/http-client-implementation": "1.0" "psr/http-client-implementation": "1.0"
...@@ -627,7 +676,7 @@ ...@@ -627,7 +676,7 @@
"ext-curl": "*", "ext-curl": "*",
"php-http/client-integration-tests": "^3.0", "php-http/client-integration-tests": "^3.0",
"phpunit/phpunit": "^8.5.5 || ^9.3.5", "phpunit/phpunit": "^8.5.5 || ^9.3.5",
"psr/log": "^1.1" "psr/log": "^1.1 || ^2.0 || ^3.0"
}, },
"suggest": { "suggest": {
"ext-curl": "Required for CURL handler support", "ext-curl": "Required for CURL handler support",
...@@ -637,7 +686,7 @@ ...@@ -637,7 +686,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "7.3-dev" "dev-master": "7.4-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -653,19 +702,43 @@ ...@@ -653,19 +702,43 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{ {
"name": "Michael Dowling", "name": "Michael Dowling",
"email": "mtdowling@gmail.com", "email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling" "homepage": "https://github.com/mtdowling"
}, },
{
"name": "Jeremy Lindblom",
"email": "jeremeamia@gmail.com",
"homepage": "https://github.com/jeremeamia"
},
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{ {
"name": "Márk Sági-Kazár", "name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com", "email": "mark.sagikazar@gmail.com",
"homepage": "https://sagikazarmark.hu" "homepage": "https://github.com/sagikazarmark"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
} }
], ],
"description": "Guzzle is a PHP HTTP client library", "description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [ "keywords": [
"client", "client",
"curl", "curl",
...@@ -679,7 +752,7 @@ ...@@ -679,7 +752,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/guzzle/issues", "issues": "https://github.com/guzzle/guzzle/issues",
"source": "https://github.com/guzzle/guzzle/tree/7.3.0" "source": "https://github.com/guzzle/guzzle/tree/7.4.0"
}, },
"funding": [ "funding": [
{ {
...@@ -691,28 +764,24 @@ ...@@ -691,28 +764,24 @@
"type": "github" "type": "github"
}, },
{ {
"url": "https://github.com/alexeyshockov", "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle",
"type": "github" "type": "tidelift"
},
{
"url": "https://github.com/gmponos",
"type": "github"
} }
], ],
"time": "2021-03-23T11:33:13+00:00" "time": "2021-10-18T09:52:00+00:00"
}, },
{ {
"name": "guzzlehttp/promises", "name": "guzzlehttp/promises",
"version": "1.4.1", "version": "1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/promises.git", "url": "https://github.com/guzzle/promises.git",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" "reference": "136a635e2b4a49b9d79e9c8fee267ffb257fdba0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", "url": "https://api.github.com/repos/guzzle/promises/zipball/136a635e2b4a49b9d79e9c8fee267ffb257fdba0",
"reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", "reference": "136a635e2b4a49b9d79e9c8fee267ffb257fdba0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -724,7 +793,7 @@ ...@@ -724,7 +793,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.4-dev" "dev-master": "1.5-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -740,10 +809,25 @@ ...@@ -740,10 +809,25 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{ {
"name": "Michael Dowling", "name": "Michael Dowling",
"email": "mtdowling@gmail.com", "email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling" "homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion"
} }
], ],
"description": "Guzzle promises library", "description": "Guzzle promises library",
...@@ -752,22 +836,36 @@ ...@@ -752,22 +836,36 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/promises/issues", "issues": "https://github.com/guzzle/promises/issues",
"source": "https://github.com/guzzle/promises/tree/1.4.1" "source": "https://github.com/guzzle/promises/tree/1.5.0"
},
"funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
}, },
"time": "2021-03-07T09:25:29+00:00" {
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises",
"type": "tidelift"
}
],
"time": "2021-10-07T13:05:22+00:00"
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "2.0.0", "version": "2.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7" "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72",
"reference": "1dc8d9cba3897165e16d12bb13d813afb1eb3fe7", "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -791,7 +889,7 @@ ...@@ -791,7 +889,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0-dev" "dev-master": "2.1-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -804,13 +902,34 @@ ...@@ -804,13 +902,34 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Graham Campbell",
"email": "hello@gjcampbell.co.uk",
"homepage": "https://github.com/GrahamCampbell"
},
{ {
"name": "Michael Dowling", "name": "Michael Dowling",
"email": "mtdowling@gmail.com", "email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling" "homepage": "https://github.com/mtdowling"
}, },
{
"name": "George Mponos",
"email": "gmponos@gmail.com",
"homepage": "https://github.com/gmponos"
},
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
"homepage": "https://github.com/Nyholm"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com",
"homepage": "https://github.com/sagikazarmark"
},
{ {
"name": "Tobias Schultze", "name": "Tobias Schultze",
"email": "webmaster@tubo-world.de",
"homepage": "https://github.com/Tobion" "homepage": "https://github.com/Tobion"
}, },
{ {
...@@ -832,9 +951,23 @@ ...@@ -832,9 +951,23 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.0.0" "source": "https://github.com/guzzle/psr7/tree/2.1.0"
}, },
"time": "2021-06-30T20:03:07+00:00" "funding": [
{
"url": "https://github.com/GrahamCampbell",
"type": "github"
},
{
"url": "https://github.com/Nyholm",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7",
"type": "tidelift"
}
],
"time": "2021-10-06T17:43:30+00:00"
}, },
{ {
"name": "nelmio/cors-bundle", "name": "nelmio/cors-bundle",
...@@ -952,16 +1085,16 @@ ...@@ -952,16 +1085,16 @@
}, },
{ {
"name": "phpdocumentor/reflection-docblock", "name": "phpdocumentor/reflection-docblock",
"version": "5.2.2", "version": "5.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" "reference": "622548b623e81ca6d78b721c5e029f4ce664f170"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170",
"reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", "reference": "622548b623e81ca6d78b721c5e029f4ce664f170",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -972,7 +1105,8 @@ ...@@ -972,7 +1105,8 @@
"webmozart/assert": "^1.9.1" "webmozart/assert": "^1.9.1"
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "~1.3.2" "mockery/mockery": "~1.3.2",
"psalm/phar": "^4.8"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
...@@ -1002,22 +1136,22 @@ ...@@ -1002,22 +1136,22 @@
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": { "support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0"
}, },
"time": "2020-09-03T19:13:55+00:00" "time": "2021-10-19T17:43:47+00:00"
}, },
{ {
"name": "phpdocumentor/type-resolver", "name": "phpdocumentor/type-resolver",
"version": "1.4.0", "version": "1.5.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git", "url": "https://github.com/phpDocumentor/TypeResolver.git",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1025,7 +1159,8 @@ ...@@ -1025,7 +1159,8 @@
"phpdocumentor/reflection-common": "^2.0" "phpdocumentor/reflection-common": "^2.0"
}, },
"require-dev": { "require-dev": {
"ext-tokenizer": "*" "ext-tokenizer": "*",
"psalm/phar": "^4.8"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
...@@ -1051,9 +1186,9 @@ ...@@ -1051,9 +1186,9 @@
"description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
"support": { "support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues", "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1"
}, },
"time": "2020-09-17T18:55:26+00:00" "time": "2021-10-02T14:08:47+00:00"
}, },
{ {
"name": "psr/cache", "name": "psr/cache",
...@@ -4734,16 +4869,16 @@ ...@@ -4734,16 +4869,16 @@
}, },
{ {
"name": "symfony/twig-bridge", "name": "symfony/twig-bridge",
"version": "v5.3.4", "version": "v5.3.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/twig-bridge.git", "url": "https://github.com/symfony/twig-bridge.git",
"reference": "587c45ef49256279502b4a29146b9e87ad23426f" "reference": "503e12aded4d5cbda4f8d1f3824c6a108119822f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/twig-bridge/zipball/587c45ef49256279502b4a29146b9e87ad23426f", "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/503e12aded4d5cbda4f8d1f3824c6a108119822f",
"reference": "587c45ef49256279502b4a29146b9e87ad23426f", "reference": "503e12aded4d5cbda4f8d1f3824c6a108119822f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -4835,7 +4970,7 @@ ...@@ -4835,7 +4970,7 @@
"description": "Provides integration for Twig with various Symfony components", "description": "Provides integration for Twig with various Symfony components",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/twig-bridge/tree/v5.3.4" "source": "https://github.com/symfony/twig-bridge/tree/v5.3.7"
}, },
"funding": [ "funding": [
{ {
...@@ -4851,7 +4986,7 @@ ...@@ -4851,7 +4986,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-26T16:33:26+00:00" "time": "2021-08-26T07:28:06+00:00"
}, },
{ {
"name": "symfony/twig-bundle", "name": "symfony/twig-bundle",
...@@ -5376,16 +5511,16 @@ ...@@ -5376,16 +5511,16 @@
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.3.2", "version": "v3.3.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "21578f00e83d4a82ecfa3d50752b609f13de6790" "reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/21578f00e83d4a82ecfa3d50752b609f13de6790", "url": "https://api.github.com/repos/twigphp/Twig/zipball/a27fa056df8a6384316288ca8b0fa3a35fdeb569",
"reference": "21578f00e83d4a82ecfa3d50752b609f13de6790", "reference": "a27fa056df8a6384316288ca8b0fa3a35fdeb569",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -5395,7 +5530,7 @@ ...@@ -5395,7 +5530,7 @@
}, },
"require-dev": { "require-dev": {
"psr/container": "^1.0", "psr/container": "^1.0",
"symfony/phpunit-bridge": "^4.4.9|^5.0.9" "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
...@@ -5436,7 +5571,7 @@ ...@@ -5436,7 +5571,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.3.2" "source": "https://github.com/twigphp/Twig/tree/v3.3.3"
}, },
"funding": [ "funding": [
{ {
...@@ -5448,7 +5583,7 @@ ...@@ -5448,7 +5583,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-16T12:14:13+00:00" "time": "2021-09-17T08:44:23+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
...@@ -5568,16 +5703,16 @@ ...@@ -5568,16 +5703,16 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
"version": "v2.6.0", "version": "v2.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/amphp/amp.git", "url": "https://github.com/amphp/amp.git",
"reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc" "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/amphp/amp/zipball/caa95edeb1ca1bf7532e9118ede4a3c3126408cc", "url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae",
"reference": "caa95edeb1ca1bf7532e9118ede4a3c3126408cc", "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -5645,7 +5780,7 @@ ...@@ -5645,7 +5780,7 @@
"support": { "support": {
"irc": "irc://irc.freenode.org/amphp", "irc": "irc://irc.freenode.org/amphp",
"issues": "https://github.com/amphp/amp/issues", "issues": "https://github.com/amphp/amp/issues",
"source": "https://github.com/amphp/amp/tree/v2.6.0" "source": "https://github.com/amphp/amp/tree/v2.6.1"
}, },
"funding": [ "funding": [
{ {
...@@ -5653,7 +5788,7 @@ ...@@ -5653,7 +5788,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-07-16T20:06:06+00:00" "time": "2021-09-23T18:43:08+00:00"
}, },
{ {
"name": "amphp/byte-stream", "name": "amphp/byte-stream",
...@@ -5734,16 +5869,16 @@ ...@@ -5734,16 +5869,16 @@
}, },
{ {
"name": "composer/package-versions-deprecated", "name": "composer/package-versions-deprecated",
"version": "1.11.99.3", "version": "1.11.99.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/package-versions-deprecated.git", "url": "https://github.com/composer/package-versions-deprecated.git",
"reference": "fff576ac850c045158a250e7e27666e146e78d18" "reference": "b174585d1fe49ceed21928a945138948cb394600"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/fff576ac850c045158a250e7e27666e146e78d18", "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600",
"reference": "fff576ac850c045158a250e7e27666e146e78d18", "reference": "b174585d1fe49ceed21928a945138948cb394600",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -5787,7 +5922,7 @@ ...@@ -5787,7 +5922,7 @@
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"support": { "support": {
"issues": "https://github.com/composer/package-versions-deprecated/issues", "issues": "https://github.com/composer/package-versions-deprecated/issues",
"source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.3" "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4"
}, },
"funding": [ "funding": [
{ {
...@@ -5803,7 +5938,7 @@ ...@@ -5803,7 +5938,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-08-17T13:49:14+00:00" "time": "2021-09-13T08:41:34+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
...@@ -6180,24 +6315,24 @@ ...@@ -6180,24 +6315,24 @@
}, },
{ {
"name": "monolog/monolog", "name": "monolog/monolog",
"version": "2.3.2", "version": "2.3.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Seldaek/monolog.git", "url": "https://github.com/Seldaek/monolog.git",
"reference": "71312564759a7db5b789296369c1a264efc43aad" "reference": "fd4380d6fc37626e2f799f29d91195040137eba9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/71312564759a7db5b789296369c1a264efc43aad", "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd4380d6fc37626e2f799f29d91195040137eba9",
"reference": "71312564759a7db5b789296369c1a264efc43aad", "reference": "fd4380d6fc37626e2f799f29d91195040137eba9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2", "php": ">=7.2",
"psr/log": "^1.0.1" "psr/log": "^1.0.1 || ^2.0 || ^3.0"
}, },
"provide": { "provide": {
"psr/log-implementation": "1.0.0" "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
}, },
"require-dev": { "require-dev": {
"aws/aws-sdk-php": "^2.4.9 || ^3.0", "aws/aws-sdk-php": "^2.4.9 || ^3.0",
...@@ -6205,14 +6340,14 @@ ...@@ -6205,14 +6340,14 @@
"elasticsearch/elasticsearch": "^7", "elasticsearch/elasticsearch": "^7",
"graylog2/gelf-php": "^1.4.2", "graylog2/gelf-php": "^1.4.2",
"mongodb/mongodb": "^1.8", "mongodb/mongodb": "^1.8",
"php-amqplib/php-amqplib": "~2.4", "php-amqplib/php-amqplib": "~2.4 || ^3",
"php-console/php-console": "^3.1.3", "php-console/php-console": "^3.1.3",
"phpspec/prophecy": "^1.6.1", "phpspec/prophecy": "^1.6.1",
"phpstan/phpstan": "^0.12.91", "phpstan/phpstan": "^0.12.91",
"phpunit/phpunit": "^8.5", "phpunit/phpunit": "^8.5",
"predis/predis": "^1.1", "predis/predis": "^1.1",
"rollbar/rollbar": "^1.3", "rollbar/rollbar": "^1.3",
"ruflin/elastica": ">=0.90 <7.0.1", "ruflin/elastica": ">=0.90@dev",
"swiftmailer/swiftmailer": "^5.3|^6.0" "swiftmailer/swiftmailer": "^5.3|^6.0"
}, },
"suggest": { "suggest": {
...@@ -6220,8 +6355,11 @@ ...@@ -6220,8 +6355,11 @@
"doctrine/couchdb": "Allow sending log messages to a CouchDB server", "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
"ext-mbstring": "Allow to work properly with unicode symbols", "ext-mbstring": "Allow to work properly with unicode symbols",
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
"ext-openssl": "Required to send log messages using SSL",
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
...@@ -6260,7 +6398,7 @@ ...@@ -6260,7 +6398,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/Seldaek/monolog/issues", "issues": "https://github.com/Seldaek/monolog/issues",
"source": "https://github.com/Seldaek/monolog/tree/2.3.2" "source": "https://github.com/Seldaek/monolog/tree/2.3.5"
}, },
"funding": [ "funding": [
{ {
...@@ -6272,7 +6410,7 @@ ...@@ -6272,7 +6410,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-23T07:42:52+00:00" "time": "2021-10-01T21:08:31+00:00"
}, },
{ {
"name": "netresearch/jsonmapper", "name": "netresearch/jsonmapper",
...@@ -6327,16 +6465,16 @@ ...@@ -6327,16 +6465,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v4.12.0", "version": "v4.13.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "6608f01670c3cc5079e18c1dab1104e002579143" "reference": "50953a2691a922aa1769461637869a0a2faa3f53"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6608f01670c3cc5079e18c1dab1104e002579143", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53",
"reference": "6608f01670c3cc5079e18c1dab1104e002579143", "reference": "50953a2691a922aa1769461637869a0a2faa3f53",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -6377,9 +6515,9 @@ ...@@ -6377,9 +6515,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.12.0" "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0"
}, },
"time": "2021-07-21T10:44:31+00:00" "time": "2021-09-20T12:20:58+00:00"
}, },
{ {
"name": "openlss/lib-array2xml", "name": "openlss/lib-array2xml",
...@@ -6843,16 +6981,16 @@ ...@@ -6843,16 +6981,16 @@
}, },
{ {
"name": "symfony/dom-crawler", "name": "symfony/dom-crawler",
"version": "v5.3.4", "version": "v5.3.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dom-crawler.git", "url": "https://github.com/symfony/dom-crawler.git",
"reference": "2dd8890bd01be59a5221999c05ccf0fcafcb354f" "reference": "c7eef3a60ccfdd8eafe07f81652e769ac9c7146c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2dd8890bd01be59a5221999c05ccf0fcafcb354f", "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/c7eef3a60ccfdd8eafe07f81652e769ac9c7146c",
"reference": "2dd8890bd01be59a5221999c05ccf0fcafcb354f", "reference": "c7eef3a60ccfdd8eafe07f81652e769ac9c7146c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -6898,7 +7036,7 @@ ...@@ -6898,7 +7036,7 @@
"description": "Eases DOM navigation for HTML and XML documents", "description": "Eases DOM navigation for HTML and XML documents",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/dom-crawler/tree/v5.3.4" "source": "https://github.com/symfony/dom-crawler/tree/v5.3.7"
}, },
"funding": [ "funding": [
{ {
...@@ -6914,7 +7052,7 @@ ...@@ -6914,7 +7052,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-23T15:55:36+00:00" "time": "2021-08-29T19:32:13+00:00"
}, },
{ {
"name": "symfony/http-client", "name": "symfony/http-client",
...@@ -7005,16 +7143,16 @@ ...@@ -7005,16 +7143,16 @@
}, },
{ {
"name": "symfony/monolog-bridge", "name": "symfony/monolog-bridge",
"version": "v5.3.4", "version": "v5.3.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/monolog-bridge.git", "url": "https://github.com/symfony/monolog-bridge.git",
"reference": "a0d881165b902a04f41e873426aa52a068064ac4" "reference": "4ace41087254f099b6743333155071438bfb12c3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/a0d881165b902a04f41e873426aa52a068064ac4", "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/4ace41087254f099b6743333155071438bfb12c3",
"reference": "a0d881165b902a04f41e873426aa52a068064ac4", "reference": "4ace41087254f099b6743333155071438bfb12c3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -7069,7 +7207,7 @@ ...@@ -7069,7 +7207,7 @@
"description": "Provides integration for Monolog with various Symfony components", "description": "Provides integration for Monolog with various Symfony components",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/monolog-bridge/tree/v5.3.4" "source": "https://github.com/symfony/monolog-bridge/tree/v5.3.7"
}, },
"funding": [ "funding": [
{ {
...@@ -7085,7 +7223,7 @@ ...@@ -7085,7 +7223,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-07-23T15:55:36+00:00" "time": "2021-08-13T15:54:02+00:00"
}, },
{ {
"name": "symfony/monolog-bundle", "name": "symfony/monolog-bundle",
......
...@@ -11,5 +11,4 @@ parameters: ...@@ -11,5 +11,4 @@ parameters:
- vendor/bin/.phpunit/phpunit-9-0/vendor/autoload.php - vendor/bin/.phpunit/phpunit-9-0/vendor/autoload.php
excludes_analyse: excludes_analyse:
- tests/bootstrap.php - tests/bootstrap.php
- src/Swagger/DocumentationNormalizer.php
ignoreErrors: ignoreErrors:
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/> <server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="9"/> <server name="SYMFONY_PHPUNIT_VERSION" value="9"/>
<server name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/> <server name="SYMFONY_DEPRECATIONS_HELPER" value="weak"/>
<server name="KERNEL_CLASS" value="Dbp\Relay\BaseBundle\Tests\Kernel"/> <server name="KERNEL_CLASS" value="Dbp\Relay\BaseOrganizationBundle\Tests\Kernel"/>
</php> </php>
<testsuites> <testsuites>
<testsuite name="Project Test Suite"> <testsuite name="Project Test Suite">
......
*.private.env.json
# HTTP Requests
This request files work with PhpStorm. You can use them to test api requests.
You need to create a `http-client.private.env.json` (use `http-client.private.env.exam.json`)
for tokens like the current bearer token.
\ No newline at end of file
# Get information about one organization
GET http://127.0.0.1:8000/organizations/1190-F2050?lang=de
accept: application/ld+json
Authorization: Bearer {{bearer_token}}
###
# Search for users with name "Hands"
GET {{entry_point_url}}/people?search=Hans&page=1
accept: application/ld+json
Authorization: Bearer {{bearer_token}}
###
{
"local-dev": {
"entry_point_url": "http://127.0.0.1:8000",
// private stuff goes to http-client.private.env.json
"bearer_token": ""
},
"dev": {
"entry_point_url": "https://mw-dev.tugraz.at",
// private stuff goes to http-client.private.env.json
"bearer_token": ""
}
}
\ No newline at end of file
{
"local-dev": {
"bearer_token": "eyJhbGciOiJS_and_the_rest_of_it"
},
"dev": {
"bearer_token": "eyJhbGciOiJS_and_the_rest_of_it"
}
}
\ No newline at end of file
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\API; namespace Dbp\Relay\BaseOrganizationBundle\API;
use Dbp\Relay\BaseBundle\Entity\Organization; use Dbp\Relay\BaseOrganizationBundle\Entity\Organization;
use Dbp\Relay\BaseBundle\Entity\Person; use Dbp\Relay\BasePersonBundle\Entity\Person;
interface OrganizationProviderInterface interface OrganizationProviderInterface
{ {
......
<?php
declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\API;
use Dbp\Relay\BaseBundle\Entity\Person;
interface PersonProviderInterface
{
/**
* @param array $filters $filters['search'] can be a string to search for people (e.g. part of the name)
* @return Person[]
*/
public function getPersons(array $filters): array;
/**
* @return Person[]
*/
public function getPersonsByNameAndBirthDate(string $givenName, string $familyName, string $birthDate): array;
public function getPerson(string $id): Person;
/**
* This is only used by external services (e.g. the alma bundle) to translate external persons to internal persons
*
* @param string $service identifies the service that wants to fetch a person
* @param string $serviceID identifies person by an external id
* @return Person
*/
public function getPersonForExternalService(string $service, string $serviceID): Person;
/**
* Returns the Person matching the current user. Or null if there is no associated person
* like when the client is another server.
*/
public function getCurrentPerson(): ?Person;
}
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\Controller; namespace Dbp\Relay\BaseOrganizationBundle\Controller;
use ApiPlatform\Core\DataProvider\PaginatorInterface; use ApiPlatform\Core\DataProvider\PaginatorInterface;
use Dbp\Relay\BaseBundle\API\OrganizationProviderInterface; use Dbp\Relay\BaseOrganizationBundle\API\OrganizationProviderInterface;
use Dbp\Relay\BaseBundle\API\PersonProviderInterface; use Dbp\Relay\BasePersonBundle\API\PersonProviderInterface;
use Dbp\Relay\CoreBundle\Exception\ApiError; use Dbp\Relay\CoreBundle\Exception\ApiError;
use Dbp\Relay\CoreBundle\Helpers\ArrayFullPaginator; use Dbp\Relay\CoreBundle\Helpers\ArrayFullPaginator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\DataProvider; namespace Dbp\Relay\BaseOrganizationBundle\DataProvider;
use ApiPlatform\Core\DataProvider\ContextAwareCollectionDataProviderInterface; use ApiPlatform\Core\DataProvider\ContextAwareCollectionDataProviderInterface;
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface; use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
use Dbp\Relay\BaseBundle\API\OrganizationProviderInterface; use Dbp\Relay\BaseOrganizationBundle\API\OrganizationProviderInterface;
use Dbp\Relay\BaseBundle\Entity\Organization; use Dbp\Relay\BaseOrganizationBundle\Entity\Organization;
use Dbp\Relay\CoreBundle\Helpers\ArrayFullPaginator; use Dbp\Relay\CoreBundle\Helpers\ArrayFullPaginator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\DataProvider; namespace Dbp\Relay\BaseOrganizationBundle\DataProvider;
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface; use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface; use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
use Dbp\Relay\BaseBundle\API\OrganizationProviderInterface; use Dbp\Relay\BaseOrganizationBundle\API\OrganizationProviderInterface;
use Dbp\Relay\BaseBundle\Entity\Organization; use Dbp\Relay\BaseOrganizationBundle\Entity\Organization;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
final class OrganizationDataProvider extends AbstractController implements ItemDataProviderInterface, RestrictedDataProviderInterface final class OrganizationDataProvider extends AbstractController implements ItemDataProviderInterface, RestrictedDataProviderInterface
......
<?php
declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\DataProvider;
use ApiPlatform\Core\DataProvider\CollectionDataProviderInterface;
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
use Dbp\Relay\BaseBundle\API\PersonProviderInterface;
use Dbp\Relay\BaseBundle\Entity\Person;
use Dbp\Relay\CoreBundle\Helpers\ArrayFullPaginator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
final class PersonCollectionDataProvider extends AbstractController implements CollectionDataProviderInterface, RestrictedDataProviderInterface
{
public const ITEMS_PER_PAGE = 250;
private $api;
public function __construct(PersonProviderInterface $api)
{
$this->api = $api;
}
public function supports(string $resourceClass, string $operationName = null, array $context = []): bool
{
return Person::class === $resourceClass;
}
public function getCollection(string $resourceClass, string $operationName = null, array $context = []): ArrayFullPaginator
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
$perPage = self::ITEMS_PER_PAGE;
$page = 1;
$api = $this->api;
$filters = $context['filters'] ?? [];
if (isset($context['filters']['page'])) {
$page = (int) $context['filters']['page'];
}
if (isset($context['filters']['perPage'])) {
$perPage = (int) $context['filters']['perPage'];
}
$persons = $api->getPersons($filters);
// TODO: do pagination via API
$pagination = new ArrayFullPaginator($persons, $page, $perPage);
return $pagination;
}
}
<?php
declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\DataProvider;
use ApiPlatform\Core\DataProvider\ItemDataProviderInterface;
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
use Dbp\Relay\BaseBundle\API\PersonProviderInterface;
use Dbp\Relay\BaseBundle\Entity\Person;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
final class PersonItemDataProvider extends AbstractController implements ItemDataProviderInterface, RestrictedDataProviderInterface
{
private $api;
public function __construct(PersonProviderInterface $api)
{
$this->api = $api;
}
public function supports(string $resourceClass, string $operationName = null, array $context = []): bool
{
return Person::class === $resourceClass;
}
public function getItem(string $resourceClass, $id, string $operationName = null, array $context = []): ?Person
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
$person = null;
$api = $this->api;
$person = $api->getPerson($id);
return $person;
}
}
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle; namespace Dbp\Relay\BaseOrganizationBundle;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Bundle\Bundle;
class DbpRelayBaseBundle extends Bundle class DbpRelayBaseOrganizationBundle extends Bundle
{ {
public function build(ContainerBuilder $container) public function build(ContainerBuilder $container)
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\DependencyInjection; namespace Dbp\Relay\BaseOrganizationBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\ConfigurationInterface;
...@@ -11,7 +11,7 @@ class Configuration implements ConfigurationInterface ...@@ -11,7 +11,7 @@ class Configuration implements ConfigurationInterface
{ {
public function getConfigTreeBuilder() public function getConfigTreeBuilder()
{ {
$treeBuilder = new TreeBuilder('dbp_relay_base'); $treeBuilder = new TreeBuilder('dbp_relay_base_organization');
return $treeBuilder; return $treeBuilder;
} }
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
declare(strict_types=1); declare(strict_types=1);
namespace Dbp\Relay\BaseBundle\DependencyInjection; namespace Dbp\Relay\BaseOrganizationBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension; use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
class DbpRelayBaseExtension extends ConfigurableExtension class DbpRelayBaseOrganizationExtension extends ConfigurableExtension
{ {
public function loadInternal(array $mergedConfig, ContainerBuilder $container) public function loadInternal(array $mergedConfig, ContainerBuilder $container)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment