Remove admin bundle, roll our own CRUD controllers
This commit is contained in:
parent
bfd24948c1
commit
15847c32c2
|
@ -12,7 +12,6 @@
|
||||||
"doctrine/doctrine-bundle": "^2.9",
|
"doctrine/doctrine-bundle": "^2.9",
|
||||||
"doctrine/doctrine-migrations-bundle": "^3.2",
|
"doctrine/doctrine-migrations-bundle": "^3.2",
|
||||||
"doctrine/orm": "^2.15",
|
"doctrine/orm": "^2.15",
|
||||||
"easycorp/easyadmin-bundle": "^4",
|
|
||||||
"phpdocumentor/reflection-docblock": "^5.3",
|
"phpdocumentor/reflection-docblock": "^5.3",
|
||||||
"phpstan/phpdoc-parser": "^1.20",
|
"phpstan/phpdoc-parser": "^1.20",
|
||||||
"sensio/framework-extra-bundle": "^6.1",
|
"sensio/framework-extra-bundle": "^6.1",
|
||||||
|
|
252
composer.lock
generated
252
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "c83180ca22904f1cd45ca0b405d8500e",
|
"content-hash": "24fab26692524d95cb0fec16c9be8ea6",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "doctrine/annotations",
|
"name": "doctrine/annotations",
|
||||||
|
@ -1396,100 +1396,6 @@
|
||||||
},
|
},
|
||||||
"time": "2022-05-23T21:33:49+00:00"
|
"time": "2022-05-23T21:33:49+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "easycorp/easyadmin-bundle",
|
|
||||||
"version": "v4.7.6",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/EasyCorp/EasyAdminBundle.git",
|
|
||||||
"reference": "60e04377612ce4d63ad833209127541caaf7e93b"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/EasyCorp/EasyAdminBundle/zipball/60e04377612ce4d63ad833209127541caaf7e93b",
|
|
||||||
"reference": "60e04377612ce4d63ad833209127541caaf7e93b",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"doctrine/doctrine-bundle": "^2.5",
|
|
||||||
"doctrine/orm": "^2.10",
|
|
||||||
"ext-json": "*",
|
|
||||||
"php": ">=8.0.2",
|
|
||||||
"symfony/asset": "^5.4|^6.0",
|
|
||||||
"symfony/cache": "^5.4|^6.0",
|
|
||||||
"symfony/config": "^5.4|^6.0",
|
|
||||||
"symfony/dependency-injection": "^5.4|^6.0",
|
|
||||||
"symfony/deprecation-contracts": "^3.0",
|
|
||||||
"symfony/doctrine-bridge": "^5.4|^6.0",
|
|
||||||
"symfony/event-dispatcher": "^5.4|^6.0",
|
|
||||||
"symfony/filesystem": "^5.4|^6.0",
|
|
||||||
"symfony/form": "^5.4|^6.0",
|
|
||||||
"symfony/framework-bundle": "^5.4|^6.0",
|
|
||||||
"symfony/http-foundation": "^5.4|^6.0",
|
|
||||||
"symfony/http-kernel": "^5.4|^6.0",
|
|
||||||
"symfony/intl": "^5.4|^6.0",
|
|
||||||
"symfony/property-access": "^5.4|^6.0",
|
|
||||||
"symfony/security-bundle": "^5.4|^6.0",
|
|
||||||
"symfony/string": "^5.4|^6.0",
|
|
||||||
"symfony/translation": "^5.4|^6.0",
|
|
||||||
"symfony/twig-bundle": "^5.4|^6.0",
|
|
||||||
"symfony/uid": "^5.4|^6.0",
|
|
||||||
"symfony/validator": "^5.4|^6.0"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"doctrine/doctrine-fixtures-bundle": "^3.4",
|
|
||||||
"phpstan/extension-installer": "^1.2",
|
|
||||||
"phpstan/phpstan": "^1.9",
|
|
||||||
"phpstan/phpstan-phpunit": "^1.2",
|
|
||||||
"phpstan/phpstan-strict-rules": "^1.4",
|
|
||||||
"phpstan/phpstan-symfony": "^1.2",
|
|
||||||
"psr/log": "^1.0",
|
|
||||||
"symfony/browser-kit": "^5.4|^6.0",
|
|
||||||
"symfony/css-selector": "^5.4|^6.0",
|
|
||||||
"symfony/debug-bundle": "^5.4|^6.0",
|
|
||||||
"symfony/dom-crawler": "^5.4|^6.0",
|
|
||||||
"symfony/phpunit-bridge": "^5.4|^6.0"
|
|
||||||
},
|
|
||||||
"type": "symfony-bundle",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-master": "4.0.x-dev"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"EasyCorp\\Bundle\\EasyAdminBundle\\": "src/"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Project Contributors",
|
|
||||||
"homepage": "https://github.com/EasyCorp/EasyAdminBundle/graphs/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Admin generator for Symfony applications",
|
|
||||||
"homepage": "https://github.com/EasyCorp/EasyAdminBundle",
|
|
||||||
"keywords": [
|
|
||||||
"admin",
|
|
||||||
"backend",
|
|
||||||
"generator"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/EasyCorp/EasyAdminBundle/issues",
|
|
||||||
"source": "https://github.com/EasyCorp/EasyAdminBundle/tree/v4.7.6"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://github.com/javiereguiluz",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2023-09-07T06:13:39+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "egulias/email-validator",
|
"name": "egulias/email-validator",
|
||||||
"version": "4.0.1",
|
"version": "4.0.1",
|
||||||
|
@ -5267,88 +5173,6 @@
|
||||||
],
|
],
|
||||||
"time": "2023-07-28T09:04:16+00:00"
|
"time": "2023-07-28T09:04:16+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "symfony/polyfill-uuid",
|
|
||||||
"version": "v1.28.0",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/polyfill-uuid.git",
|
|
||||||
"reference": "9c44518a5aff8da565c8a55dbe85d2769e6f630e"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/9c44518a5aff8da565c8a55dbe85d2769e6f630e",
|
|
||||||
"reference": "9c44518a5aff8da565c8a55dbe85d2769e6f630e",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=7.1"
|
|
||||||
},
|
|
||||||
"provide": {
|
|
||||||
"ext-uuid": "*"
|
|
||||||
},
|
|
||||||
"suggest": {
|
|
||||||
"ext-uuid": "For best performance"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"extra": {
|
|
||||||
"branch-alias": {
|
|
||||||
"dev-main": "1.28-dev"
|
|
||||||
},
|
|
||||||
"thanks": {
|
|
||||||
"name": "symfony/polyfill",
|
|
||||||
"url": "https://github.com/symfony/polyfill"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"autoload": {
|
|
||||||
"files": [
|
|
||||||
"bootstrap.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Polyfill\\Uuid\\": ""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Grégoire Pineau",
|
|
||||||
"email": "lyrixx@lyrixx.info"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "https://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Symfony polyfill for uuid functions",
|
|
||||||
"homepage": "https://symfony.com",
|
|
||||||
"keywords": [
|
|
||||||
"compatibility",
|
|
||||||
"polyfill",
|
|
||||||
"portable",
|
|
||||||
"uuid"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"source": "https://github.com/symfony/polyfill-uuid/tree/v1.28.0"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://symfony.com/sponsor",
|
|
||||||
"type": "custom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://github.com/fabpot",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
|
||||||
"type": "tidelift"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2023-01-26T09:26:14+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/process",
|
"name": "symfony/process",
|
||||||
"version": "v6.2.13",
|
"version": "v6.2.13",
|
||||||
|
@ -6809,80 +6633,6 @@
|
||||||
],
|
],
|
||||||
"time": "2023-02-14T08:44:56+00:00"
|
"time": "2023-02-14T08:44:56+00:00"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "symfony/uid",
|
|
||||||
"version": "v6.2.7",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/symfony/uid.git",
|
|
||||||
"reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/symfony/uid/zipball/d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0",
|
|
||||||
"reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0",
|
|
||||||
"shasum": ""
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=8.1",
|
|
||||||
"symfony/polyfill-uuid": "^1.15"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
|
||||||
"symfony/console": "^5.4|^6.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Symfony\\Component\\Uid\\": ""
|
|
||||||
},
|
|
||||||
"exclude-from-classmap": [
|
|
||||||
"/Tests/"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"MIT"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Grégoire Pineau",
|
|
||||||
"email": "lyrixx@lyrixx.info"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Nicolas Grekas",
|
|
||||||
"email": "p@tchwork.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Symfony Community",
|
|
||||||
"homepage": "https://symfony.com/contributors"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Provides an object-oriented API to generate and represent UIDs",
|
|
||||||
"homepage": "https://symfony.com",
|
|
||||||
"keywords": [
|
|
||||||
"UID",
|
|
||||||
"ulid",
|
|
||||||
"uuid"
|
|
||||||
],
|
|
||||||
"support": {
|
|
||||||
"source": "https://github.com/symfony/uid/tree/v6.2.7"
|
|
||||||
},
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"url": "https://symfony.com/sponsor",
|
|
||||||
"type": "custom"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://github.com/fabpot",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
|
||||||
"type": "tidelift"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"time": "2023-02-14T08:44:56+00:00"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "symfony/validator",
|
"name": "symfony/validator",
|
||||||
"version": "v6.2.13",
|
"version": "v6.2.13",
|
||||||
|
|
|
@ -12,5 +12,4 @@ return [
|
||||||
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
|
||||||
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
|
||||||
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
|
||||||
EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle::class => ['all' => true],
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -25,7 +25,6 @@ security:
|
||||||
role_hierarchy:
|
role_hierarchy:
|
||||||
ROLE_ADMIN: ROLE_USER
|
ROLE_ADMIN: ROLE_USER
|
||||||
access_control:
|
access_control:
|
||||||
- { path: ^/admin, roles: ROLE_ADMIN }
|
|
||||||
- { path: ^/manage, roles: ROLE_USER }
|
- { path: ^/manage, roles: ROLE_USER }
|
||||||
|
|
||||||
when@test:
|
when@test:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
framework:
|
|
||||||
uid:
|
|
||||||
default_uuid_version: 7
|
|
||||||
time_based_uuid_version: 7
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller\Admin;
|
|
||||||
|
|
||||||
use App\Controller\Admin\PodcastCrudController;
|
|
||||||
use App\Entity\Episode;
|
|
||||||
use App\Entity\Podcast;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
|
|
||||||
class DashboardController extends AbstractDashboardController
|
|
||||||
{
|
|
||||||
#[Route('/admin', name: 'admin')]
|
|
||||||
public function index(): Response
|
|
||||||
{
|
|
||||||
$adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);
|
|
||||||
return $this->redirect($adminUrlGenerator->setController(PodcastCrudController::class)->generateUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureDashboard(): Dashboard
|
|
||||||
{
|
|
||||||
return Dashboard::new()->setTitle('LSBC');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureMenuItems(): iterable
|
|
||||||
{
|
|
||||||
yield MenuItem::linkToCrud('Podcasts', 'fas fa-list', Podcast::class);
|
|
||||||
yield MenuItem::linkToCrud('Episodes', 'fas fa-list', Episode::class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller\Admin;
|
|
||||||
|
|
||||||
use App\Constants;
|
|
||||||
use App\Entity\Episode;
|
|
||||||
use App\Controller\Admin\Field\FileField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Filters;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
|
||||||
|
|
||||||
class EpisodeCrudController extends AbstractCrudController
|
|
||||||
{
|
|
||||||
public static function getEntityFqcn(): string
|
|
||||||
{
|
|
||||||
return Episode::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureFilters(Filters $filters): Filters
|
|
||||||
{
|
|
||||||
return $filters
|
|
||||||
->add('podcast');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureFields(string $pageName): iterable
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
TextField::new('title'),
|
|
||||||
TextEditorField::new('description'),
|
|
||||||
AssociationField::new('podcast'),
|
|
||||||
DateTimeField::new('publicationDate'),
|
|
||||||
FileField::new('audioFilename')
|
|
||||||
->setUploadDir(Constants::BASE_PUBLIC_DIR . Constants::FILES_BASE_PATH)
|
|
||||||
->setBasePath(Constants::FILES_BASE_PATH),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller\Admin\Field;
|
|
||||||
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Asset;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Option\TextAlign;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Field\FieldInterface;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\FieldTrait;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Form\Type\FileUploadType;
|
|
||||||
use Symfony\Contracts\Translation\TranslatableInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
|
|
||||||
*/
|
|
||||||
final class FileField implements FieldInterface
|
|
||||||
{
|
|
||||||
use FieldTrait;
|
|
||||||
|
|
||||||
public const OPTION_BASE_PATH = 'basePath';
|
|
||||||
public const OPTION_UPLOAD_DIR = 'uploadDir';
|
|
||||||
public const OPTION_UPLOADED_FILE_NAME_PATTERN = 'uploadedFileNamePattern';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param TranslatableInterface|string|false|null $label
|
|
||||||
*/
|
|
||||||
public static function new(string $propertyName, $label = null): self
|
|
||||||
{
|
|
||||||
return (new self())
|
|
||||||
->setProperty($propertyName)
|
|
||||||
->setLabel($label)
|
|
||||||
->setTemplatePath('admin/field/file.html.twig')
|
|
||||||
->setFormType(FileUploadType::class)
|
|
||||||
->addCssClass('field-file')
|
|
||||||
->addJsFiles(Asset::fromEasyAdminAssetPackage('field-file-upload.js'))
|
|
||||||
->setTextAlign(TextAlign::CENTER)
|
|
||||||
->setCustomOption(self::OPTION_BASE_PATH, null)
|
|
||||||
->setCustomOption(self::OPTION_UPLOAD_DIR, null)
|
|
||||||
->setCustomOption(self::OPTION_UPLOADED_FILE_NAME_PATTERN, '[name].[extension]');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setBasePath(string $path): self
|
|
||||||
{
|
|
||||||
$this->setCustomOption(self::OPTION_BASE_PATH, $path);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Relative to project's root directory (e.g. use 'public/uploads/' for `<your-project-dir>/public/uploads/`)
|
|
||||||
* Default upload dir: `<your-project-dir>/public/uploads/images/`.
|
|
||||||
*/
|
|
||||||
public function setUploadDir(string $uploadDirPath): self
|
|
||||||
{
|
|
||||||
$this->setCustomOption(self::OPTION_UPLOAD_DIR, $uploadDirPath);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string|\Closure $patternOrCallable
|
|
||||||
*
|
|
||||||
* If it's a string, uploaded files will be renamed according to the given pattern.
|
|
||||||
* The pattern can include the following special values:
|
|
||||||
* [day] [month] [year] [timestamp]
|
|
||||||
* [name] [slug] [extension] [contenthash]
|
|
||||||
* [randomhash] [uuid] [ulid]
|
|
||||||
* (e.g. [year]/[month]/[day]/[slug]-[contenthash].[extension])
|
|
||||||
*
|
|
||||||
* If it's a callable, you will be passed the Symfony's UploadedFile instance and you must
|
|
||||||
* return a string with the new filename.
|
|
||||||
* (e.g. fn(UploadedFile $file) => sprintf('upload_%d_%s.%s', random_int(1, 999), $file->getFilename(), $file->guessExtension()))
|
|
||||||
*/
|
|
||||||
public function setUploadedFileNamePattern($patternOrCallable): self
|
|
||||||
{
|
|
||||||
$this->setCustomOption(self::OPTION_UPLOADED_FILE_NAME_PATTERN, $patternOrCallable);
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller\Admin;
|
|
||||||
|
|
||||||
use App\Constants;
|
|
||||||
use App\Entity\Podcast;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\EmailField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\UrlField;
|
|
||||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
|
||||||
|
|
||||||
class PodcastCrudController extends AbstractCrudController
|
|
||||||
{
|
|
||||||
public static function getEntityFqcn(): string
|
|
||||||
{
|
|
||||||
return Podcast::class;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function configureFields(string $pageName): iterable
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
TextField::new('name'),
|
|
||||||
UrlField::new('website'),
|
|
||||||
TextEditorField::new('description'),
|
|
||||||
TextField::new('author'),
|
|
||||||
EmailField::new('email'),
|
|
||||||
ImageField::new('logoFilename')
|
|
||||||
->setUploadDir(Constants::BASE_PUBLIC_DIR . Constants::IMAGES_BASE_PATH)
|
|
||||||
->setBasePath(Constants::IMAGES_BASE_PATH),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
21
symfony.lock
21
symfony.lock
|
@ -35,15 +35,6 @@
|
||||||
"migrations/.gitignore"
|
"migrations/.gitignore"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"easycorp/easyadmin-bundle": {
|
|
||||||
"version": "4.6",
|
|
||||||
"recipe": {
|
|
||||||
"repo": "github.com/symfony/recipes",
|
|
||||||
"branch": "main",
|
|
||||||
"version": "3.0",
|
|
||||||
"ref": "b131e6cbfe1b898a508987851963fff485986285"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"phpunit/phpunit": {
|
"phpunit/phpunit": {
|
||||||
"version": "9.6",
|
"version": "9.6",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
@ -248,18 +239,6 @@
|
||||||
"templates/base.html.twig"
|
"templates/base.html.twig"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"symfony/uid": {
|
|
||||||
"version": "6.2",
|
|
||||||
"recipe": {
|
|
||||||
"repo": "github.com/symfony/recipes",
|
|
||||||
"branch": "main",
|
|
||||||
"version": "6.2",
|
|
||||||
"ref": "d294ad4add3e15d7eb1bae0221588ca89b38e558"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"config/packages/uid.yaml"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"symfony/validator": {
|
"symfony/validator": {
|
||||||
"version": "6.2",
|
"version": "6.2",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
|
|
||||||
{# @var field \EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto #}
|
|
||||||
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
|
|
||||||
{% set files = field.formattedValue %}
|
|
||||||
{% if files is not iterable %}
|
|
||||||
{% set files = [files] %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for file in files %}
|
|
||||||
<span>{{ file }}</span>
|
|
||||||
{% endfor %}
|
|
Loading…
Reference in a new issue