Skip to content
Snippets Groups Projects
Commit 968734b2 authored by Groß-Vogt, Tobias's avatar Groß-Vogt, Tobias
Browse files

#40977: removed depreate organization-by-person filter from organization collection GET operation

parent cd5bcbe3
No related branches found
No related tags found
No related merge requests found
Pipeline #236005 passed
<?php
declare(strict_types=1);
namespace Dbp\Relay\BaseOrganizationBundle\API;
use Dbp\Relay\CoreBundle\Exception\ApiError;
use Dbp\Relay\CoreBundle\Pagination\Paginator;
interface OrganizationsByPersonProviderInterface
{
/**
* @throws ApiError
*/
public function getOrganizationsByPerson(string $personId, array $options = []): Paginator;
}
...@@ -5,7 +5,6 @@ declare(strict_types=1); ...@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace Dbp\Relay\BaseOrganizationBundle\DataProvider; namespace Dbp\Relay\BaseOrganizationBundle\DataProvider;
use Dbp\Relay\BaseOrganizationBundle\API\OrganizationProviderInterface; use Dbp\Relay\BaseOrganizationBundle\API\OrganizationProviderInterface;
use Dbp\Relay\BaseOrganizationBundle\API\OrganizationsByPersonProviderInterface;
use Dbp\Relay\BaseOrganizationBundle\Entity\Organization; use Dbp\Relay\BaseOrganizationBundle\Entity\Organization;
use Dbp\Relay\CoreBundle\DataProvider\AbstractDataProvider; use Dbp\Relay\CoreBundle\DataProvider\AbstractDataProvider;
use Dbp\Relay\CoreBundle\Locale\Locale; use Dbp\Relay\CoreBundle\Locale\Locale;
...@@ -15,13 +14,9 @@ class OrganizationDataProvider extends AbstractDataProvider ...@@ -15,13 +14,9 @@ class OrganizationDataProvider extends AbstractDataProvider
/** @var OrganizationProviderInterface */ /** @var OrganizationProviderInterface */
private $organizationProvider; private $organizationProvider;
/** @var OrganizationsByPersonProviderInterface */ public function __construct(OrganizationProviderInterface $organizationProvider)
private $organizationsByPersonProvider;
public function __construct(OrganizationProviderInterface $organizationProvider, OrganizationsByPersonProviderInterface $organizationsByPersonProvider)
{ {
$this->organizationProvider = $organizationProvider; $this->organizationProvider = $organizationProvider;
$this->organizationsByPersonProvider = $organizationsByPersonProvider;
} }
protected function getResourceClass(): string protected function getResourceClass(): string
...@@ -51,19 +46,6 @@ class OrganizationDataProvider extends AbstractDataProvider ...@@ -51,19 +46,6 @@ class OrganizationDataProvider extends AbstractDataProvider
$this->tryAddDeprecatedLangQueryParameter($options, $filters); $this->tryAddDeprecatedLangQueryParameter($options, $filters);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// @deprecate The 'person' filter is deprecate. Use the 'identifiers' filter in your custom organization wrapper.
$personId = $filters['person'] ?? '';
if ($personId !== '') {
$organizations = [];
foreach ($this->organizationsByPersonProvider->getOrganizationsByPerson($personId, $options) as $organizationId) {
$organizations[] = $this->organizationProvider->getOrganizationById($organizationId, $options);
}
return $organizations;
}
//-------------------------------------------------------------------------
if ($search = ($filters['search'] ?? null)) { if ($search = ($filters['search'] ?? null)) {
$options['search'] = $search; $options['search'] = $search;
} }
......
...@@ -19,7 +19,6 @@ use Dbp\Relay\CoreBundle\LocalData\LocalDataAwareTrait; ...@@ -19,7 +19,6 @@ use Dbp\Relay\CoreBundle\LocalData\LocalDataAwareTrait;
* "tags" = {"BaseOrganization"}, * "tags" = {"BaseOrganization"},
* "parameters" = { * "parameters" = {
* {"name" = "search", "in" = "query", "description" = "Search filter (partial, case-insensitive text search on 'name' attribute)", "type" = "string", "required" = false}, * {"name" = "search", "in" = "query", "description" = "Search filter (partial, case-insensitive text search on 'name' attribute)", "type" = "string", "required" = false},
* {"name" = "person", "in" = "query", "description" = "DEPRECATED: Get organizations of a person (ID of BasePerson resource)", "type" = "string", "required" = false},
* {"name" = "queryLocal", "in" = "query", "description" = "Local query parameters to apply", "type" = "string"}, * {"name" = "queryLocal", "in" = "query", "description" = "Local query parameters to apply", "type" = "string"},
* {"name" = "includeLocal", "in" = "query", "description" = "Local data attributes to include", "type" = "string", "example" = "code"} * {"name" = "includeLocal", "in" = "query", "description" = "Local data attributes to include", "type" = "string", "example" = "code"}
* } * }
......
<?php
declare(strict_types=1);
namespace Dbp\Relay\BaseOrganizationBundle\Service;
use Dbp\Relay\BaseOrganizationBundle\API\OrganizationsByPersonProviderInterface;
use Dbp\Relay\CoreBundle\Pagination\Paginator;
use Dbp\Relay\CoreBundle\Pagination\WholeResultPaginator;
class DummyOrganizationsByPersonProvider implements OrganizationsByPersonProviderInterface
{
public function getOrganizationsByPerson(string $personId, array $options = []): Paginator
{
return new WholeResultPaginator([], 1, 30);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment