Skip to content

Commit

Permalink
edit namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilvestre committed Oct 23, 2024
1 parent 02d4392 commit 9edf05d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/custom_filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace App\Grid\Filter;
use App\Form\Type\Filter\SuppliersStatisticsFilterType;
use Sylius\Bundle\GridBundle\Doctrine\DataSourceInterface;
use Sylius\Component\Grid\Filtering\FilterInterface;
use Sylius\Component\Grid\Metadata\AsFilter;
use Sylius\Component\Grid\Attribute\AsFilter;

#[AsFilter(formType: SuppliersStatisticsFilterType::class)]
class SuppliersStatisticsFilter implements FilterInterface
Expand Down
9 changes: 7 additions & 2 deletions src/Bundle/DependencyInjection/SyliusGridExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
use Sylius\Bundle\CurrencyBundle\SyliusCurrencyBundle;
use Sylius\Bundle\GridBundle\Grid\GridInterface;
use Sylius\Bundle\GridBundle\SyliusGridBundle;
use Sylius\Component\Grid\Attribute\AsFilter;
use Sylius\Component\Grid\Data\DataProviderInterface;
use Sylius\Component\Grid\Filtering\FilterInterface;
use Sylius\Component\Grid\Metadata\AsFilter;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand Down Expand Up @@ -65,7 +65,12 @@ public function load(array $configs, ContainerBuilder $container): void
$container->registerAttributeForAutoconfiguration(
AsFilter::class,
static function (ChildDefinition $definition, AsFilter $attribute, \Reflector $reflector): void {
$definition->addTag(AsFilter::SERVICE_TAG, [
// Helps to avoid issues with psalm
if (!$reflector instanceof \ReflectionClass) {
return;
}

$definition->addTag(AsFilter::SERVICE_TAG, [
'type' => $attribute->getType() ?? $reflector->getName(),
'form_type' => $attribute->getFormType(),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Sylius\Component\Grid\Metadata;
namespace Sylius\Component\Grid\Attribute;

#[\Attribute(\Attribute::TARGET_CLASS)]
final class AsFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
namespace App\Filter;

use App\Grid\Type\NationalityFilterType;
use Sylius\Component\Grid\Attribute\AsFilter;
use Sylius\Component\Grid\Data\DataSourceInterface;
use Sylius\Component\Grid\Filter\EntityFilter;
use Sylius\Component\Grid\Filtering\FilterInterface;
use Sylius\Component\Grid\Metadata\AsFilter;

#[AsFilter(
formType: NationalityFilterType::class,
Expand Down

0 comments on commit 9edf05d

Please sign in to comment.