Skip to content

feat: iri search filter #7079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Apr 10, 2025

Q A
Branch? main
Tickets continues the work at #6865
License MIT
Doc PR TODO

@@ -22,7 +22,7 @@
use Symfony\Component\Serializer\Annotation\Groups;

#[ApiResource]
#[GetCollection]
#[GetCollection()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[GetCollection()]
#[GetCollection]

@@ -22,7 +22,7 @@
use Symfony\Component\Serializer\Annotation\Groups;

#[ApiResource]
#[GetCollection]
#[GetCollection()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[GetCollection()]
#[GetCollection]

Copy link
Contributor

@vinceAmstoutz vinceAmstoutz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of these suggestions will solve the 2 PHPStan errors & some tests failures @soyuka

Comment on lines +120 to +121
if (null === $parameter->getProvider() && (($f = $parameter->getFilter()) && $f instanceof ParameterProviderFilterInterface)) {
$parameters->add($key, $parameter->withProvider($f->getParameterProvider()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (null === $parameter->getProvider() && (($f = $parameter->getFilter()) && $f instanceof ParameterProviderFilterInterface)) {
$parameters->add($key, $parameter->withProvider($f->getParameterProvider()));
if (null === $parameter->getProvider() && (($filter = $parameter->getFilter()) && $f instanceof ParameterProviderFilterInterface)) {
$parameters->add($key, $parameter->withProvider($filter->getParameterProvider()));

class Chicken
{
#[ODM\Id]
private string $id;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private string $id;
private ?string $id = null;

use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

#[ODM\Document]
#[GetCollection(normalizationContext: ['hydra_prefix' => false], parameters: ['chickens' => new QueryParameter(filter: new IriFilter())])]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[GetCollection(normalizationContext: ['hydra_prefix' => false], parameters: ['chickens' => new QueryParameter(filter: new IriFilter())])]
#[GetCollection(
normalizationContext: ['hydra_prefix' => false],
parameters: ['chickens' => new QueryParameter(filter: new IriFilter())]
)]

use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[Get()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[Get()]
#[Get]


namespace ApiPlatform\Tests\Fixtures\TestBundle\Document;

use ApiPlatform\Doctrine\Orm\Filter\IriFilter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use ApiPlatform\Doctrine\Orm\Filter\IriFilter;
use ApiPlatform\Doctrine\Odm\Filter\IriFilter;

use ApiPlatform\Doctrine\Orm\Filter\IriFilter;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\QueryParameter;
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\Chicken;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\Chicken;
use ApiPlatform\Tests\Fixtures\TestBundle\Document\Chicken;

use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
#[GetCollection(normalizationContext: ['hydra_prefix' => false], parameters: ['chickens' => new QueryParameter(filter: new IriFilter())])]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[GetCollection(normalizationContext: ['hydra_prefix' => false], parameters: ['chickens' => new QueryParameter(filter: new IriFilter())])]
#[GetCollection(
normalizationContext: ['hydra_prefix' => false],
parameters: ['chickens' => new QueryParameter(filter: new IriFilter())]
)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants