Kaynağa Gözat

Refactoring repository

feature/ticket
Fab 3 yıl önce
ebeveyn
işleme
0bf6756039
8 değiştirilmiş dosya ile 67 ekleme ve 24 silme
  1. +5
    -13
      Controller/Config/TaxRateAdminController.php
  2. +29
    -0
      Controller/Config/UnitAdminController.php
  3. +3
    -0
      Repository/Config/TaxRateRepository.php
  4. +10
    -5
      Repository/Config/UnitRepository.php
  5. +1
    -1
      Repository/RepositoryTrait.php
  6. +4
    -1
      Repository/Section/SectionRepository.php
  7. +2
    -4
      Repository/User/GroupUserRepository.php
  8. +13
    -0
      Resources/translations/admin.fr.yaml

+ 5
- 13
Controller/Config/TaxRateAdminController.php Dosyayı Görüntüle

@@ -20,18 +20,10 @@ abstract class TaxRateAdminController extends AbstractAdminController

public function configureFields(string $pageName): iterable
{
$id = IntegerField::new('id', 'ID');
$title = TextField::new('title');
$value = NumberField::new('value');

if (Crud::PAGE_INDEX === $pageName) {
return [$id, $title, $value];
} elseif (Crud::PAGE_DETAIL === $pageName) {
return [$id, $title, $value];
} elseif (Crud::PAGE_NEW === $pageName) {
return [$title, $value];
} elseif (Crud::PAGE_EDIT === $pageName) {
return [$title, $value];
}
return [
IntegerField::new('id', 'ID')->hideOnForm(),
TextField::new('title'),
NumberField::new('value')
];
}
}

+ 29
- 0
Controller/Config/UnitAdminController.php Dosyayı Görüntüle

@@ -0,0 +1,29 @@
<?php

namespace Lc\CaracoleBundle\Controller\Config;

use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\AbstractAdminController;

abstract class UnitAdminController extends AbstractAdminController
{
use AdminControllerTrait;

public function configureFields(string $pageName): iterable
{
return [
IntegerField::new('id', 'ID')->hideOnForm(),
TextField::new('unit'),
TextField::new('wording'),
TextField::new('wordingUnit'),
TextField::new('wordingShort'),
IntegerField::new('coefficient'),
AssociationField::new('unitReference'),
];
}
}

+ 3
- 0
Repository/Config/TaxRateRepository.php Dosyayı Görüntüle

@@ -3,6 +3,7 @@
namespace Lc\CaracoleBundle\Repository\Config;

use Lc\CaracoleBundle\Model\Config\TaxRateInterface;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;

/**
@@ -13,6 +14,8 @@ use Lc\SovBundle\Repository\AbstractRepository;
*/
class TaxRateRepository extends AbstractRepository
{
use RepositoryTrait;

public function getInterfaceClass()
{
return TaxRateInterface::class;

+ 10
- 5
Repository/Config/UnitRepository.php Dosyayı Görüntüle

@@ -2,9 +2,10 @@

namespace Lc\CaracoleBundle\Repository\Config;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Lc\CaracoleBundle\Model\Config\TaxRateInterface;
use Lc\CaracoleBundle\Model\Config\UnitInterface;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method UnitInterface|null find($id, $lockMode = null, $lockVersion = null)
@@ -12,10 +13,14 @@ use Lc\CaracoleBundle\Model\Config\UnitInterface;
* @method UnitInterface[] findAll()
* @method UnitInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class UnitRepository extends ServiceEntityRepository
class UnitRepository extends AbstractRepository
{
public function __construct(ManagerRegistry $registry)
use RepositoryTrait;

public function getInterfaceClass()
{
parent::__construct($registry, UnitInterface::class);
return UnitInterface::class;
}


}

Repository/AbstractRepository.php → Repository/RepositoryTrait.php Dosyayı Görüntüle

@@ -9,7 +9,7 @@ use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\SovBundle\Repository\AbstractRepository as SovAbstractRepository;

abstract class AbstractRepository extends SovAbstractRepository
trait RepositoryTrait
{
protected $merchantResolver;
protected $sectionResolver;

+ 4
- 1
Repository/Section/SectionRepository.php Dosyayı Görüntüle

@@ -3,7 +3,8 @@
namespace Lc\CaracoleBundle\Repository\Section;

use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\AbstractRepository;
use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Repository\AbstractRepository;

/**
* @method SectionInterface|null find($id, $lockMode = null, $lockVersion = null)
@@ -13,6 +14,8 @@ use Lc\CaracoleBundle\Repository\AbstractRepository;
*/
class SectionRepository extends AbstractRepository
{
use RepositoryTrait;

public function getInterfaceClass()
{
return SectionInterface::class;

+ 2
- 4
Repository/User/GroupUserRepository.php Dosyayı Görüntüle

@@ -2,6 +2,7 @@

namespace Lc\CaracoleBundle\Repository\User;

use Lc\CaracoleBundle\Repository\RepositoryTrait;
use Lc\SovBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Repository\User\GroupUserRepository as SovGroupUserRepository;

@@ -13,8 +14,5 @@ use Lc\SovBundle\Repository\User\GroupUserRepository as SovGroupUserRepository;
*/
class GroupUserRepository extends SovGroupUserRepository
{
public function getInterfaceClass()
{
return GroupUserInterface::class;
}
use RepositoryTrait;
}

+ 13
- 0
Resources/translations/admin.fr.yaml Dosyayı Görüntüle

@@ -7,9 +7,11 @@ menu:
admin_merchant: Marchands
admin_section: Sections
admin_tva: TVA
admin_unit: Unités
user_merchant_index: Utilisateurs
group_user_index: Groupes d'utilisateurs


flash_message:
settings_saved: Paramètres mis à jour

@@ -52,6 +54,17 @@ entity:
GroupUser:
label: Groupe d'utilisateur
label_plurial: Groupes d'utilisateurs
Unit:
label: Unité
label_plurial: Unités
fields:
unit: Unité
wording: Nom
wordingUnit: Nom long
wordingShort: Nom court
coefficient: Coefficient
unitReference: Unité de référence


form:
user_merchant:

Yükleniyor…
İptal
Kaydet