Prérequis :
[@EcommitCrud](https://github.com/EcommitCrud)/Theme/base.html.twig)[@EcommitCrud](https://github.com/EcommitCrud)/IconTheme/base.html.twig)Installez le bundle avec Composer : A la racine de votre projet Symfony, éxécutez la commande suivante :
$ composer require ecommit/crud-bundle:3.*[@dev](https://github.com/dev)
$ npm install --save-dev [@ecommit](https://github.com/ecommit)/crud-bundle@file:vendor/ecommit/crud-bundle/assets
Activez le bundle dans le fichier de configuration config/bundles.php de votre projet :
return [
//...
Ecommit\CrudBundle\EcommitCrudBundle::class => ['all' => true],
//...
];
Ajoutez à votre projet le fichier de configuration config/packages/ecommit_crud.yaml :
ecommit_crud:
#Theme
#Themes disponibles :
#[@EcommitCrud](https://github.com/EcommitCrud)/Theme/base.html.twig
#[@EcommitCrud](https://github.com/EcommitCrud)/Theme/bootstrap3.html.twig (boostrap3 requis)
#[@EcommitCrud](https://github.com/EcommitCrud)/Theme/bootstrap4.html.twig (boostrap4 requis)
#[@EcommitCrud](https://github.com/EcommitCrud)/Theme/bootstrap5.html.twig (boostrap5 requis)
#Ou faire son propre terme (doit hériter de l'un des thèmes précédents)
theme: '[@EcommitCrud](https://github.com/EcommitCrud)/Theme/bootstrap5.html.twig'
#Theme pour les icones
#Themes disponibles :
#[@EcommitCrud](https://github.com/EcommitCrud)/IconTheme/base.html.twig
#[@EcommitCrud](https://github.com/EcommitCrud)/IconTheme/fontawesome4.html.twig (fontawesome4 requis)
#[@EcommitCrud](https://github.com/EcommitCrud)/IconTheme/fontawesome5_solid.html.twig (fontawesome5 Solid requis)
#[@EcommitCrud](https://github.com/EcommitCrud)/IconTheme/fontawesome6_solid.html.twig (fontawesome5 Solid requis)
#Ou faire son propre terme (doit hériter de l'un des thèmes précédents)
icon_theme: '[@EcommitCrud](https://github.com/EcommitCrud)/IconTheme/fontawesome6_solid.html.twig'
Votre entité Doctrine "utilisateur" doit implémenter l'interface Ecommit\CrudBundle\Entity\UserCrudInterface. Exemple :
<?php
namespace App\Entity;
use Ecommit\CrudBundle\Entity\UserCrudInterface;
use Symfony\Component\Security\Core\User\UserInterface;
class User implements UserInterface, UserCrudInterface
{
//...
}
La configuration Doctrine doit être adaptée en conséquence :
#config/packages/doctrine.yaml
doctrine:
orm:
resolve_target_entities:
#Adaptez App\Entity\User en fonction du nom de votre classe utilisateur
Ecommit\CrudBundle\Entity\UserCrudInterface: App\Entity\User
Dans votre entrée principale Webpack Encore, rajoutez les instructions suivantes :
//Exemple dans assets/js/app.js
import '[@ecommit](https://github.com/ecommit)/crud-bundle/js/crud';
import * as modalManager from '[@ecommit](https://github.com/ecommit)/crud-bundle/js/modal/modal-manager';
//Choix du moteur de modal (exemple avec Boostrap5)
//Bootstrap5 requis (et chargé via Webpack Encore)
var modalEngine = require('[@ecommit](https://github.com/ecommit)/crud-bundle/js/modal/engine/bootstrap5');
modalManager.defineEngine(modalEngine);
Recompiliez avec Webpack Encore:
npm run dev
Mettez à jour vos entités Doctrine :
php bin/console doctrine:schema:update --force
#Ou si vous utilisez Doctrine Migrations:
#php bin/console doctrine:migrations:diff
#php bin/console doctrine:migrations:migrate
How can I help you explore Laravel packages today?