浏览代码

Merge branch 'develop' of https://gitea.laclic.fr/Laclic/SovBundle into develop

feature/ticket
Fab 3 年前
父节点
当前提交
557dec76e6
共有 14 个文件被更改,包括 52 次插入48 次删除
  1. +1
    -2
      Authenticator/LoginFormAuthenticator.php
  2. +5
    -3
      Controller/AbstractAdminController.php
  3. +0
    -20
      Controller/Admin/UserCrudController.php
  4. +1
    -1
      Controller/Dashboard/DashboardController.php
  5. +1
    -1
      Controller/Security/SecurityController.php
  6. +18
    -0
      Controller/User/UserAdminController.php
  7. +1
    -1
      Controller/User/UserController.php
  8. +16
    -11
      Form/Common/CrudFormType.php
  9. +1
    -1
      Form/Common/FileManagerType.php
  10. +1
    -1
      Form/Common/PositionType.php
  11. +1
    -1
      Form/User/ChangePasswordFormType.php
  12. +1
    -1
      Form/User/ProfileFormType.php
  13. +4
    -4
      Resources/config/routes.yaml
  14. +1
    -1
      Resources/config/services.yaml

+ 1
- 2
Authenticator/LoginFormAuthenticator.php 查看文件



if (isset($useReferer) && $useReferer == true) { if (isset($useReferer) && $useReferer == true) {
$url = $request->request->get('_target_path'); $url = $request->request->get('_target_path');

} else { } else {
$user = $this->entityManager->getRepository(UserInterface::class)->findOneBy(['email' => $email]); $user = $this->entityManager->getRepository(UserInterface::class)->findOneBy(['email' => $email]);


$roles = $user->getRoles(); $roles = $user->getRoles();


foreach ($rolesRedirection as $roleRedirect) { foreach ($rolesRedirection as $roleRedirect) {
if (array_search($roleRedirect['role'], $roles)) {
if (in_array($roleRedirect['role'], $roles)) {
$routeName = $roleRedirect['redirect']; $routeName = $roleRedirect['redirect'];
} }
} }

Controller/Admin/AbstractCrudController.php → Controller/AbstractAdminController.php 查看文件

<?php <?php


namespace Lc\SovBundle\Controller\Admin;
namespace Lc\SovBundle\Controller;


use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;




abstract class AbstractCrudController extends EaAbstractCrudController
abstract class AbstractAdminController extends EaAbstractCrudController
{ {
protected $session; protected $session;
protected $request; protected $request;


public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
if ($this->isInstanceOf(SortableInterface::class)) {
$seoPanel = $confPanel = array();

if ($this->isInstanceOf(SeoInterface::class)) {
$seoPanel = [ $seoPanel = [
FormField::addPanel('seo')->setTemplateName('crud/field/generic'), FormField::addPanel('seo')->setTemplateName('crud/field/generic'),
TextField::new('metaTitle')->setLabel('Meta Title')->setHelp( TextField::new('metaTitle')->setLabel('Meta Title')->setHelp(

+ 0
- 20
Controller/Admin/UserCrudController.php 查看文件

<?php

namespace Lc\SovBundle\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;

abstract class UserCrudController extends AbstractCrudController
{

public function configureFields(string $pageName): iterable
{
return [
TextField::new('email')
];
}

}

Controller/Admin/DashboardController.php → Controller/Dashboard/DashboardController.php 查看文件

<?php <?php


namespace Lc\SovBundle\Controller\Admin;
namespace Lc\SovBundle\Controller\Dashboard;


use EasyCorp\Bundle\EasyAdminBundle\Config\Assets; use EasyCorp\Bundle\EasyAdminBundle\Config\Assets;
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud; use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;

Controller/Admin/SecurityController.php → Controller/Security/SecurityController.php 查看文件

<?php <?php


namespace Lc\SovBundle\Controller\Admin;
namespace Lc\SovBundle\Controller\Security;


use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;

+ 18
- 0
Controller/User/UserAdminController.php 查看文件

<?php

namespace Lc\SovBundle\Controller\User;

use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\AbstractAdminController;

abstract class UserAdminController extends AbstractAdminController
{

public function configureFields(string $pageName): iterable
{
return [
TextField::new('email')
];
}

}

Controller/Admin/UserController.php → Controller/User/UserController.php 查看文件

<?php <?php


namespace Lc\SovBundle\Controller\Admin;
namespace Lc\SovBundle\Controller\User;


use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto; use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider; use EasyCorp\Bundle\EasyAdminBundle\Provider\AdminContextProvider;

Form/Type/Crud/CrudFormType.php → Form/Common/CrudFormType.php 查看文件

<?php <?php


namespace Lc\SovBundle\Form\Type\Crud;
namespace Lc\SovBundle\Form\Common;




use EasyCorp\Bundle\EasyAdminBundle\Form\Type\EaFormPanelType; use EasyCorp\Bundle\EasyAdminBundle\Form\Type\EaFormPanelType;


protected $parent; protected $parent;
protected $doctrineOrmTypeGuesser; protected $doctrineOrmTypeGuesser;
public function __construct(DoctrineOrmTypeGuesser $doctrineOrmTypeGuesser, \EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType $crudFormType)
{

public function __construct(
DoctrineOrmTypeGuesser $doctrineOrmTypeGuesser,
\EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType $crudFormType
) {
$this->parent = $crudFormType; $this->parent = $crudFormType;
$this->doctrineOrmTypeGuesser = $doctrineOrmTypeGuesser; $this->doctrineOrmTypeGuesser = $doctrineOrmTypeGuesser;

} }


public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$this->parent->buildForm($builder, $options); $this->parent->buildForm($builder, $options);
$entityDto = $options['entityDto']; $entityDto = $options['entityDto'];
$formPanels=[];
$formPanels = [];
$currentFormPanel = 0; $currentFormPanel = 0;
foreach ($entityDto->getFields() as $fieldDto) { foreach ($entityDto->getFields() as $fieldDto) {
if (null === $formFieldType = $fieldDto->getFormType()) { if (null === $formFieldType = $fieldDto->getFormType()) {
'help' => $fieldDto->getHelp(), 'help' => $fieldDto->getHelp(),
'css_class' => $fieldDto->getCssClass(), 'css_class' => $fieldDto->getCssClass(),
]; ];
foreach($fieldDto->getCustomOptions()->all() as $customOptionKey=> $customOption){
foreach ($fieldDto->getCustomOptions()->all() as $customOptionKey => $customOption) {
$formPanels[$currentFormPanel][$customOptionKey] = $customOption; $formPanels[$currentFormPanel][$customOptionKey] = $customOption;
} }
continue; continue;
//$this->niche->buildForm($builder, $options); //$this->niche->buildForm($builder, $options);
} }


public function finishView(FormView $view, FormInterface $form, array $options){
public function finishView(FormView $view, FormInterface $form, array $options)
{
$this->parent->finishView($view, $form, $options); $this->parent->finishView($view, $form, $options);
} }
public function configureOptions(OptionsResolver $resolver){
$this->parent->configureOptions($resolver);


public function configureOptions(OptionsResolver $resolver)
{
$this->parent->configureOptions($resolver);
} }
public function getBlockPrefix(){

public function getBlockPrefix()
{
return $this->parent->getBlockPrefix(); return $this->parent->getBlockPrefix();
} }





} }

Form/Type/Crud/FileManagerType.php → Form/Common/FileManagerType.php 查看文件

<?php <?php


namespace Lc\SovBundle\Form\Type\Crud;
namespace Lc\SovBundle\Form\Common;


use Lc\SovBundle\DataTransformer\FileManagerTypeToDataTransformer; use Lc\SovBundle\DataTransformer\FileManagerTypeToDataTransformer;
use Lc\SovBundle\Entity\File\File; use Lc\SovBundle\Entity\File\File;

Form/Type/Crud/PositionType.php → Form/Common/PositionType.php 查看文件

<?php <?php


namespace Lc\SovBundle\Form\Type\Crud;
namespace Lc\SovBundle\Form\Common;




use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;

Form/Type/User/ChangePasswordFormType.php → Form/User/ChangePasswordFormType.php 查看文件

* file that was distributed with this source code. * file that was distributed with this source code.
*/ */


namespace Lc\SovBundle\Form\Type\User;
namespace Lc\SovBundle\Form\User;


use Lc\SovBundle\Doctrine\EntityManager; use Lc\SovBundle\Doctrine\EntityManager;
use Lc\SovBundle\Model\User\UserInterface; use Lc\SovBundle\Model\User\UserInterface;

Form/Type/User/ProfileFormType.php → Form/User/ProfileFormType.php 查看文件

<?php <?php


namespace Lc\SovBundle\Form\Type\User;
namespace Lc\SovBundle\Form\User;


use Lc\SovBundle\DataTransformer\FileManagerTypeToDataTransformer; use Lc\SovBundle\DataTransformer\FileManagerTypeToDataTransformer;
use Lc\SovBundle\Doctrine\EntityManager; use Lc\SovBundle\Doctrine\EntityManager;

+ 4
- 4
Resources/config/routes.yaml 查看文件



sov_login: sov_login:
path: /login path: /login
controller: Lc\SovBundle\Controller\Admin\SecurityController::login
controller: Lc\SovBundle\Controller\Security\SecurityController::login


sov_logout: sov_logout:
path: /logout path: /logout
controller: Lc\SovBundle\Controller\Admin\SecurityController::logout
controller: Lc\SovBundle\Controller\Security\SecurityController::logout


sov_admin_account_profile: sov_admin_account_profile:
path: /admin/account/profile path: /admin/account/profile
controller: Lc\SovBundle\Controller\Admin\UserController::profile
controller: Lc\SovBundle\Controller\User\UserController::profile


sov_admin_account_password: sov_admin_account_password:
path: /admin/account/password path: /admin/account/password
controller: Lc\SovBundle\Controller\Admin\UserController::changePassword
controller: Lc\SovBundle\Controller\User\UserController::changePassword



+ 1
- 1
Resources/config/services.yaml 查看文件

resource: '../../Controller/' resource: '../../Controller/'
tags: [ 'controller.service_arguments' ] tags: [ 'controller.service_arguments' ]


Lc\SovBundle\Form\Type\Crud\CrudFormType:
Lc\SovBundle\Form\Common\CrudFormType:
decorates: EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType decorates: EasyCorp\Bundle\EasyAdminBundle\Form\Type\CrudFormType
arguments: [ '@form.type_guesser.doctrine', '@.inner' ] arguments: [ '@form.type_guesser.doctrine', '@.inner' ]



正在加载...
取消
保存