Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/Dto/CrudDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,11 @@ public function setCustomPageTitle(string $pageName, TranslatableInterface|strin
*/
public function getDefaultPageTitle(?string $pageName = null, ?object $entityInstance = null, array $translationParameters = []): ?TranslatableInterface
{
if (null !== $entityInstance) {
if ($entityInstance instanceof \Stringable) {
$entityAsString = (string) $entityInstance;
if ($entityInstance instanceof \Stringable) {
$entityAsString = (string) $entityInstance;

if ('' !== $entityAsString) {
return t($entityAsString, $translationParameters, 'EasyAdminBundle');
}
if ('' !== $entityAsString) {
return t($entityAsString, $translationParameters, 'EasyAdminBundle');
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/Dto/SearchDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ public function getQuery(): string
public function getQueryTerms(): array
{
preg_match_all('/"(?:\\\\.|[^\\\\"])*"|\S+/', $this->query, $matches);
$terms = array_map(static fn ($match) => trim($match, '" '), $matches[0]);

return $terms;
return array_map(static fn ($match) => trim($match, '" '), $matches[0]);
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/Factory/AdminContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ public function create(Request $request, DashboardControllerInterface $dashboard
$validPageNames = [Crud::PAGE_INDEX, Crud::PAGE_DETAIL, Crud::PAGE_EDIT, Crud::PAGE_NEW];
$pageName = \in_array($crudAction, $validPageNames, true) ? $crudAction : null;

$dashboardDto = $this->getDashboardDto($request, $dashboardController);
$dashboardDto = $this->getDashboardDto($dashboardController);
$assetDto = $this->getAssetDto($dashboardController, $crudController, $pageName);
$filters = $this->getFilters($dashboardController, $crudController);
$user = $this->getUser($this->tokenStorage);

// build a first version of CrudDto without actions so we can create AdminContext, which is
// needed for action extensions; later, we'll update the CrudDto object with the full action config
Expand Down Expand Up @@ -105,7 +104,7 @@ public function create(Request $request, DashboardControllerInterface $dashboard
return $adminContext;
}

private function getDashboardDto(Request $request, DashboardControllerInterface $dashboardControllerInstance): DashboardDto
private function getDashboardDto(DashboardControllerInterface $dashboardControllerInstance): DashboardDto
{
$dashboardRoutes = $this->adminRouteGenerator->getDashboardRoutes();
$dashboardFqcn = $dashboardControllerInstance::class;
Expand Down Expand Up @@ -196,7 +195,7 @@ private function getI18nDto(Request $request, DashboardDto $dashboardDto, ?CrudD
$translationParameters['%entity_id%'] = $entityId = EntityIdReader::fromRequest($request);
$translationParameters['%entity_short_id%'] = null === $entityId ? null : u($entityId)->truncate(7)->toString();

$entityInstance = null === $entityDto ? null : $entityDto->getInstance();
$entityInstance = $entityDto?->getInstance();
$pageName = $crudDto->getCurrentPage();

$singularLabel = $crudDto->getEntityLabelInSingular($entityInstance, $pageName)
Expand Down
1 change: 0 additions & 1 deletion src/Factory/FieldFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Factory;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\FieldMapping;
use EasyCorp\Bundle\EasyAdminBundle\Collection\EntityCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
Expand Down
1 change: 0 additions & 1 deletion src/Factory/FilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Factory;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\FieldMapping;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterConfiguratorInterface;
Expand Down
5 changes: 2 additions & 3 deletions src/Field/Configurator/CommonPreConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Field\Configurator;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\FieldMapping;
use Doctrine\ORM\Mapping\JoinColumnMapping;
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
Expand Down Expand Up @@ -73,7 +72,7 @@ public function configure(FieldDto $field, EntityDto $entityDto, AdminContext $c
$isVirtual = $this->buildVirtualOption($field, $entityDto);
$field->setVirtual($isVirtual);

$templatePath = $this->buildTemplatePathOption($context, $field, $entityDto, $isReadable);
$templatePath = $this->buildTemplatePathOption($context, $field, $isReadable);
$field->setTemplatePath($templatePath);

$doctrineMetadata = [];
Expand Down Expand Up @@ -173,7 +172,7 @@ private function buildVirtualOption(FieldDto $field, EntityDto $entityDto): bool
&& !$entityDto->getClassMetadata()->hasAssociation($field->getProperty());
}

private function buildTemplatePathOption(AdminContext $adminContext, FieldDto $field, EntityDto $entityDto, bool $isReadable): string
private function buildTemplatePathOption(AdminContext $adminContext, FieldDto $field, bool $isReadable): string
{
if (null !== $templatePath = $field->getTemplatePath()) {
return $templatePath;
Expand Down
1 change: 0 additions & 1 deletion src/Field/Configurator/DateTimeConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Field\Configurator;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\FieldMapping;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldConfiguratorInterface;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Intl\IntlFormatterInterface;
Expand Down
1 change: 0 additions & 1 deletion src/Filter/Configurator/TextConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Filter\Configurator;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\FieldMapping;
use EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Filter\FilterConfiguratorInterface;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
Expand Down
4 changes: 1 addition & 3 deletions src/Form/Type/ComparisonType.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function configureOptions(OptionsResolver $resolver): void
'label' => false,
'type' => 'numeric',
'choices' => static function (Options $options) {
$choices = match ($options['type']) {
return match ($options['type']) {
'numeric' => [
'filter.label.is_equal_to' => self::EQ,
'filter.label.is_not_equal_to' => self::NEQ,
Expand Down Expand Up @@ -69,8 +69,6 @@ public function configureOptions(OptionsResolver $resolver): void
],
default => [],
};

return $choices;
},
'translation_domain' => 'EasyAdminBundle',
]);
Expand Down
1 change: 0 additions & 1 deletion src/Orm/EntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\FieldMapping;
use Doctrine\ORM\Query\Expr\Orx;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
Expand Down
1 change: 0 additions & 1 deletion src/Provider/FieldProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace EasyCorp\Bundle\EasyAdminBundle\Provider;

use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\FieldMapping;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Provider\AdminContextProviderInterface;
use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
Expand Down
2 changes: 1 addition & 1 deletion src/Test/Trait/CrudTestIndexAsserts.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected function assertIndexPageEntityCount(int $expectedIndexPageEntityCount,
}

$message ??= sprintf('There should be %d results found in the current index page', $expectedIndexPageEntityCount);
static::assertSelectorNotExists('tr.no-results', );
static::assertSelectorNotExists('tr.no-results');
static::assertSelectorExists('tbody tr');

$indexPageEntityRows = $this->client->getCrawler()->filter('tbody tr');
Expand Down
Loading