Skip to content

Commit f077f14

Browse files
Zowacsoyuka
authored andcommitted
chore(elasticsearch): api-platform/elasticsearch (api-platform#5526)
1 parent 70062fd commit f077f14

File tree

54 files changed

+790
-180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+790
-180
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ jobs:
192192
- JsonSchema
193193
- OpenApi
194194
- Metadata
195+
- Elasticsearch
195196
fail-fast: false
196197
steps:
197198
- name: Checkout

src/Api/FilterLocatorTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
namespace ApiPlatform\Api;
1515

1616
use ApiPlatform\Exception\InvalidArgumentException;
17+
use ApiPlatform\Metadata\FilterInterface;
1718
use Psr\Container\ContainerInterface;
1819

1920
/**

src/Api/IriConverterInterface.php

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,6 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use ApiPlatform\Exception\InvalidArgumentException;
17-
use ApiPlatform\Exception\ItemNotFoundException;
18-
use ApiPlatform\Exception\RuntimeException;
19-
use ApiPlatform\Metadata\Operation;
20-
21-
/**
22-
* Converts item and resources to IRI and vice versa.
23-
*
24-
* @author Kévin Dunglas <[email protected]>
25-
*/
26-
interface IriConverterInterface
16+
interface IriConverterInterface extends \ApiPlatform\Metadata\IriConverterInterface
2717
{
28-
/**
29-
* Retrieves an item from its IRI.
30-
*
31-
* @throws InvalidArgumentException
32-
* @throws ItemNotFoundException
33-
*/
34-
public function getResourceFromIri(string $iri, array $context = [], Operation $operation = null): object;
35-
36-
/**
37-
* Gets the IRI associated with the given item.
38-
*
39-
* @param object|class-string $resource
40-
*
41-
* @throws InvalidArgumentException
42-
* @throws RuntimeException
43-
*/
44-
public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, Operation $operation = null, array $context = []): ?string;
4518
}

src/Api/UrlGeneratorInterface.php

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -13,72 +13,6 @@
1313

1414
namespace ApiPlatform\Api;
1515

16-
use Symfony\Component\Routing\Exception\InvalidParameterException;
17-
use Symfony\Component\Routing\Exception\MissingMandatoryParametersException;
18-
use Symfony\Component\Routing\Exception\RouteNotFoundException;
19-
20-
/**
21-
* UrlGeneratorInterface is the interface that all URL generator classes must implement.
22-
*
23-
* This interface has been imported and adapted from the Symfony project.
24-
*
25-
* The constants in this interface define the different types of resource references that
26-
* are declared in RFC 3986: http://tools.ietf.org/html/rfc3986
27-
* We are using the term "URL" instead of "URI" as this is more common in web applications
28-
* and we do not need to distinguish them as the difference is mostly semantical and
29-
* less technical. Generating URIs, i.e. representation-independent resource identifiers,
30-
* is also possible.
31-
*
32-
* @author Fabien Potencier <[email protected]>
33-
* @author Tobias Schultze <http://tobion.de>
34-
* @copyright Fabien Potencier
35-
*/
36-
interface UrlGeneratorInterface
16+
interface UrlGeneratorInterface extends \ApiPlatform\Metadata\UrlGeneratorInterface
3717
{
38-
/**
39-
* Generates an absolute URL, e.g. "http://example.com/dir/file".
40-
*/
41-
public const ABS_URL = 0;
42-
43-
/**
44-
* Generates an absolute path, e.g. "/dir/file".
45-
*/
46-
public const ABS_PATH = 1;
47-
48-
/**
49-
* Generates a relative path based on the current request path, e.g. "../parent-file".
50-
*
51-
* @see UrlGenerator::getRelativePath()
52-
*/
53-
public const REL_PATH = 2;
54-
55-
/**
56-
* Generates a network path, e.g. "//example.com/dir/file".
57-
* Such reference reuses the current scheme but specifies the host.
58-
*/
59-
public const NET_PATH = 3;
60-
61-
/**
62-
* Generates a URL or path for a specific route based on the given parameters.
63-
*
64-
* Parameters that reference placeholders in the route pattern will substitute them in the
65-
* path or host. Extra params are added as query string to the URL.
66-
*
67-
* When the passed reference type cannot be generated for the route because it requires a different
68-
* host or scheme than the current one, the method will return a more comprehensive reference
69-
* that includes the required params. For example, when you call this method with $referenceType = ABSOLUTE_PATH
70-
* but the route requires the https scheme whereas the current scheme is http, it will instead return an
71-
* ABSOLUTE_URL with the https scheme and the current host. This makes sure the generated URL matches
72-
* the route in any case.
73-
*
74-
* If there is no route with the given name, the generator must throw the RouteNotFoundException.
75-
*
76-
* The special parameter _fragment will be used as the document fragment suffixed to the final URL.
77-
*
78-
* @throws RouteNotFoundException If the named route doesn't exist
79-
* @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route
80-
* @throws InvalidParameterException When a parameter value for a placeholder is not correct because
81-
* it does not match the requirement
82-
*/
83-
public function generate(string $name, array $parameters = [], int $referenceType = self::ABS_PATH): string;
8418
}

src/Elasticsearch/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/composer.lock
2+
/vendor
3+
/.phpunit.result.cache
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Elasticsearch\Exception;
15+
16+
/**
17+
* Base exception interface.
18+
*
19+
* @author Kévin Dunglas <[email protected]>
20+
*/
21+
interface ExceptionInterface extends \Throwable
22+
{
23+
}

src/Elasticsearch/Exception/IndexNotFoundException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace ApiPlatform\Elasticsearch\Exception;
1515

16-
use ApiPlatform\Exception\ExceptionInterface;
17-
1816
/**
1917
* Index not found exception.
2018
*

src/Elasticsearch/Exception/NonUniqueIdentifierException.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
namespace ApiPlatform\Elasticsearch\Exception;
1515

16-
use ApiPlatform\Exception\ExceptionInterface;
17-
1816
/**
1917
* Non unique identifier exception.
2018
*

src/Elasticsearch/Extension/SortExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313

1414
namespace ApiPlatform\Elasticsearch\Extension;
1515

16-
use ApiPlatform\Api\ResourceClassResolverInterface;
1716
use ApiPlatform\Elasticsearch\Util\FieldDatatypeTrait;
1817
use ApiPlatform\Metadata\HttpOperation;
1918
use ApiPlatform\Metadata\Operation;
2019
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
20+
use ApiPlatform\Metadata\ResourceClassResolverInterface;
2121
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
2222

2323
/**

src/Elasticsearch/Filter/AbstractFilter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313

1414
namespace ApiPlatform\Elasticsearch\Filter;
1515

16-
use ApiPlatform\Api\ResourceClassResolverInterface;
1716
use ApiPlatform\Elasticsearch\Util\FieldDatatypeTrait;
18-
use ApiPlatform\Exception\PropertyNotFoundException;
19-
use ApiPlatform\Exception\ResourceClassNotFoundException;
17+
use ApiPlatform\Metadata\Exception\PropertyNotFoundException;
18+
use ApiPlatform\Metadata\Exception\ResourceClassNotFoundException;
2019
use ApiPlatform\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
2120
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
21+
use ApiPlatform\Metadata\ResourceClassResolverInterface;
2222
use Symfony\Component\PropertyInfo\Type;
2323
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
2424

0 commit comments

Comments
 (0)