Guillaume 5d456b26ae Merge branch 'master' of https://forge.laclic.fr/Laclic/SovBundle | 3 years ago | |
---|---|---|
Authenticator | 3 years ago | |
Builder | 3 years ago | |
Command | 3 years ago | |
Component | 3 years ago | |
Container | 3 years ago | |
Controller | 3 years ago | |
Definition | 3 years ago | |
DependencyInjection | 3 years ago | |
Doctrine | 3 years ago | |
Event | 3 years ago | |
EventListener | 3 years ago | |
EventSubscriber | 3 years ago | |
Factory | 3 years ago | |
Field | 3 years ago | |
Form | 3 years ago | |
Generator | 3 years ago | |
Maker | 3 years ago | |
Model | 3 years ago | |
Notification | 3 years ago | |
Repository | 3 years ago | |
Resolver | 3 years ago | |
Resources | 3 years ago | |
Session/Flash | 3 years ago | |
Solver | 3 years ago | |
Translation | 3 years ago | |
Twig | 3 years ago | |
.gitignore | 3 years ago | |
LcSovBundle.php | 3 years ago | |
README.md | 3 years ago | |
composer.json | 3 years ago | |
composer.lock | 3 years ago | |
package.json | 3 years ago | |
webpack.config.js | 3 years ago | |
yarn.lock | 3 years ago |
Administration basé sur EasyAdmin 3. Développé par la Clic!
Require :
Si tu démarres un nouveau projet il te suffit de cloner le projet : https://gitea.laclic.fr/Laclic/DefaultProjectSf5
Dans le dossier Lc/AdminBundle :
git clone https://gitea.laclic.fr/Laclic/AdminBundle.git .
Initialisation :
Création des entités de base, créer une entité User.php et File.php, ajouter dans la configuration de doctrine les lignes suivantes
doctrine:
orm:
resolve_target_entities:
Lc\SovBundle\IModel\User\UserInterface: App\Entity\User
Lc\SovBundle\Doctrine\Extension\FileInterface: App\Entity\File
#...
Instalation ckeditor
php bin/console ckeditor:install
`php bin/console assets:install public
Créer la config fos_ckeditor.yaml ``` fos_ck_editor: input_sync: true default_config: base_config configs:
base_config:
filebrowserBrowseRoute: file_manager
filebrowserBrowseRouteParameters:
conf: default
module: ckeditor
format_tags: 'p;h2;h3'
toolbar:
- { name: "styles", items: ['Bold', 'Italic','Underline', 'Strike']}
- { name: "paragraph", items: ['Format', 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'] }
- { name: "link", items: [ 'Link', 'Unlink'] }
- {name: 'insert', items: [ 'Image' ]}
- {name: 'document', items: [ 'Source' ]}
simple_config:
toolbar:
- { items: ['Bold', 'Italic', 'Underline', 'Colors', 'Source'] }
twig: form_themes:
’@FOSCKEditor/Form/ckeditor_widget.html.twig’
- Créer la config artgris_file_manager.yaml
artgris_file_manager:
conf:
default:
dir: "../public/uploads"
type: 'image'
```
Compare ton .gitignore avec le gitignore de DefaultProjectSf5 et ajoute les lignes manquantes
Modifier composer.json dans “autoload” ajouter :
"autoload": {
"psr-4": {
"App\\": "src/",
"Lc\\": "Lc/"
}
},
Dans le dossier config
de ton projet :
bundles.php
et ajouter :
Lc\SovBundle\SovBundle::class => ['all' => true],
services.yaml
et ajouter :
Lc\SovBundle\:
resource: '../Lc/AdminBundle/'
exclude:
- '../Lc/AdminBundle/DependencyInjection/'
- '../Lc/AdminBundle/Entity/'
- '../Lc/AdminBundle/Kernel.php'
- '../Lc/AdminBundle/Tests/'
et
Lc\SovBundle\Controller\:
resource: '../Lc/AdminBundle/Controller/'
tags: ['controller.service_arguments']
packages/security.yml
guard:
authenticators:
- Lc\SovBundle\Authenticator\LoginFormAuthenticator
packages/doctrine.yaml
resolve_target_entities:
Lc\SovBundle\IModel\User\UserInterface: App\Entity\User
routes.yaml
login:
path: /login
controller: Lc\SovBundle\Controller\Admin\SecurityController::login
logout:
path: /logout
controller: Lc\SovBundle\Admin\SecurityController::logout
Dans le dossier src/
de ton projet :
Controller/Admin/SecurityController.php
.Controller/Admin/AbstractCrudController.php
.Controller/Admin/DashboardController.php
.
````
use Lc\SovBundle\Controller\Admin\DashboardController as LcDashboardController;
class DashboardController extends LcDashboardController { // … le code spécifique }
- Modifier l'en tête des controllers. Exemple `Controller/Admin/PageCrudController.php`.
use Lc\SovBundle\Controller\AbstractAdminController as AbstractCrudController;
class PageCrudController extends AbstractCrudController { // … le code spécifique }
- Modifier `Entity/User.php`.
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM; use Lc\SovBundle\Model\User\UserInterface; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Lc\SovBundle\Model\User\User as LcUserModel;
/**
@UniqueEntity(fields={“email”}, message=“There is already an account with this email”) */ class User extends LcUserModel implements UserInterface { /**
public function getId(): ?int {
return $this->id;
}
}
- Modifier les entités pour que les Use pointe dans AdminBundle exemple avec `Entity/Page.php`.
use Lc\SovBundle\Doctrine\Extension\ImageInterface; use Lc\SovBundle\Model\Cms\AbstractDocument; use Lc\SovBundle\Model\Cms\ImageTrait;
/**
// … le code spécifique
}
- Modifier les repository pour qu'il fonctionne avec AdminBundle exemple avec `Repository/PageRepository.php.php`.
<?php
namespace App\Repository;
use App\Entity\Page; use Lc\SovBundle\Repository\RepositoryAbstract;
/**
@method Page[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class PageRepository extends RepositoryAbstract { public function getInterfaceClass() {
return Page::class;
}
// … le code spécifique }
- Supprimer `Repository/UserRepository.php.php`.
Sauf si il contient des fonctions autres que `__contruct()` et `upgradePassword-()`
Si c'est le cas le réécrire en faisant un extends de UserRepository dans AdminBundle
- Faire un `composer install`
- Tester l'application connectes toi à l'admin, édites un doc ou deux
- Si tout est ok tu peux supprimer les dossiers :
src/IModel/ src/Model/ src/Security/ src/Command/