Sfoglia il codice sorgente

Finalisation purchaseOrder et Correctif mineur

feature/symfony6.1
Fabien Normand 3 anni fa
parent
commit
aa8845a89c
4 ha cambiato i file con 33 aggiunte e 26 eliminazioni
  1. +1
    -1
      Component/EntityComponent.php
  2. +4
    -0
      Controller/ControllerTrait.php
  3. +1
    -1
      Resources/views/adminlte/block/table_filters.html.twig
  4. +27
    -24
      Translation/TranslatorAdmin.php

+ 1
- 1
Component/EntityComponent.php Vedi File

@@ -26,6 +26,7 @@ class EntityComponent

public function duplicateEntity($entity)
{

$newEntity = clone $entity;
$classMetadata = $this->entityManager->getClassMetadata(get_class($newEntity));

@@ -50,7 +51,6 @@ class EntityComponent
}
*/
$this->entityManager->create($newEntity);

$this->eventDispatcher->dispatch(new EntityComponentEvent($newEntity), EntityComponentEvent::DUPLICATE_EVENT);

return $newEntity;

+ 4
- 0
Controller/ControllerTrait.php Vedi File

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Controller;
use Doctrine\ORM\EntityManagerInterface;
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator;
use Knp\Component\Pager\PaginatorInterface;
use Lc\SovBundle\Component\FileComponent;
use Lc\SovBundle\Container\ComponentContainer;
use Lc\SovBundle\Container\File\FileContainer;
use Lc\SovBundle\Container\Newsletter\NewsletterContainer;
@@ -71,6 +72,7 @@ trait ControllerTrait
UserContainer::class => UserContainer::class,
SiteSettingContainer::class => SiteSettingContainer::class,
EntityRepository::class => EntityRepository::class,
FileComponent::class => FileComponent::class,
]
);
}
@@ -85,6 +87,8 @@ trait ControllerTrait
if ($translationEntityName === null && method_exists($this, 'getTranslationEntityName')) {
$translationEntityName = $this->getTranslationEntityName();
}


$this->get(FlashBagTranslator::class)->add(
$type,
$translationKeyName,

+ 1
- 1
Resources/views/adminlte/block/table_filters.html.twig Vedi File

@@ -1,5 +1,5 @@
{% set filters_form_are_not_empty = false %}
{% if filters_form is defined %}
{% if filters_form is defined %}
<tr class="table-filters-line">
{% if has_batch_actions %}
<th></th>

+ 27
- 24
Translation/TranslatorAdmin.php Vedi File

@@ -30,8 +30,10 @@ class TranslatorAdmin
{
if ($entityClass) {
return $this->transEntityThenDefault(
$this->buildTransIdFlash($type . '.' . $name, $entityClass),
$this->buildTransIdFlash($type . '.' . $name, $entityClass, true)
$this->buildTransIdFlash($type . '.' . $name, $entityClass),
$this->buildTransIdFlash($type . '.' . $name, $entityClass, true),
false,
$params
);
} else {
return $this->trans('flash_message.' . $name, $params);
@@ -41,20 +43,20 @@ class TranslatorAdmin
public function transField($fieldName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdField($fieldName, $entityClass),
$this->buildTransIdField($fieldName, $entityClass, true)
$this->buildTransIdField($fieldName, $entityClass),
$this->buildTransIdField($fieldName, $entityClass, true)
);
}

public function transFieldIndex($fieldName, $entityClass): string
{
$idTranslationFieldIndex = $this->buildTransIdField($fieldName.'Index', $entityClass);
$idTranslationFieldIndex = $this->buildTransIdField($fieldName . 'Index', $entityClass);

$translation = $this->trans($idTranslationFieldIndex);

if ($translation == $idTranslationFieldIndex) {
return $this->transField($fieldName, $entityClass);
}else{
} else {
return $translation;
}
}
@@ -79,41 +81,41 @@ class TranslatorAdmin
$fieldName = $fieldName . '_help';

return $this->transEntityThenDefault(
$this->buildTransIdField($fieldName, $entityClass),
$this->buildTransIdField($fieldName, $entityClass, true),
true
$this->buildTransIdField($fieldName, $entityClass),
$this->buildTransIdField($fieldName, $entityClass, true),
true
);
}

public function transPanel($panelName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdPanel($panelName, $entityClass),
$this->buildTransIdPanel($panelName, $entityClass, true)
$this->buildTransIdPanel($panelName, $entityClass),
$this->buildTransIdPanel($panelName, $entityClass, true)
);
}

public function transModal($modalName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdModal($modalName, $entityClass),
$this->buildTransIdModal($modalName, $entityClass, true)
$this->buildTransIdModal($modalName, $entityClass),
$this->buildTransIdModal($modalName, $entityClass, true)
);
}

public function transCard($cardName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdCard($cardName, $entityClass),
$this->buildTransIdCard($cardName, $entityClass, true)
$this->buildTransIdCard($cardName, $entityClass),
$this->buildTransIdCard($cardName, $entityClass, true)
);
}

public function transBox($cardName, $entityClass): string
{
return $this->transEntityThenDefault(
$this->buildTransIdBox($cardName, $entityClass),
$this->buildTransIdBox($cardName, $entityClass, true)
$this->buildTransIdBox($cardName, $entityClass),
$this->buildTransIdBox($cardName, $entityClass, true)
);
}

@@ -126,8 +128,8 @@ class TranslatorAdmin
if ($entityName) {
$baseIdEntityLabel = 'entity.' . $entityName;
$paramsTranslation = [
'%label%' => $this->trans($baseIdEntityLabel . '.label'),
'%label_plurial%' => $this->trans($baseIdEntityLabel . '.label_plurial'),
'%label%' => $this->trans($baseIdEntityLabel . '.label'),
'%label_plurial%' => $this->trans($baseIdEntityLabel . '.label_plurial'),
];
}

@@ -136,17 +138,18 @@ class TranslatorAdmin
}

return $this->trans(
'title.' . $pageName,
$paramsTranslation
'title.' . $pageName,
$paramsTranslation
);
}

private function transEntityThenDefault($idTranslationEntity, $idTranslationDefault, $returnEmpty = false): string
private function transEntityThenDefault($idTranslationEntity, $idTranslationDefault, $returnEmpty = false, $params = []): string
{
$translation = $this->trans($idTranslationEntity);

$translation = $this->trans($idTranslationEntity, $params);

if ($translation == $idTranslationEntity) {
$translation = $this->trans($idTranslationDefault);
$translation = $this->trans($idTranslationDefault, $params);

if ($translation == $idTranslationDefault) {
if ($returnEmpty) {

Loading…
Annulla
Salva