Browse Source

Correctif

feature/symfony6.1
Fabien Normand 2 years ago
parent
commit
82a7e0a969
4 changed files with 33 additions and 3 deletions
  1. +21
    -1
      Builder/User/UserBuilder.php
  2. +2
    -1
      Resources/translations/admin.fr.yaml
  3. +6
    -1
      Resources/views/adminlte/crud/form.html.twig
  4. +4
    -0
      Translation/TranslatorAdmin.php

+ 21
- 1
Builder/User/UserBuilder.php View File

@@ -5,6 +5,7 @@ namespace Lc\SovBundle\Builder\User;
use Doctrine\ORM\EntityManagerInterface;
use Lc\SovBundle\Doctrine\EntityInterface;
use Lc\SovBundle\Doctrine\Extension\BlameableInterface;
use Lc\SovBundle\Factory\User\UserFactory;
use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
use Lc\SovBundle\Model\User\UserInterface;
use Lc\SovBundle\Repository\User\UserStore;
@@ -15,11 +16,29 @@ class UserBuilder
protected EntityManagerInterface $entityManager;
protected UserStore $userStore;
protected UserSolver $userSolver;
public function __construct(EntityManagerInterface $entityManager, UserStore $userStore, UserSolver $userSolver)
protected UserFactory $userFactory;

public function __construct(EntityManagerInterface $entityManager, UserStore $userStore, UserSolver $userSolver, UserFactory $userFactory)
{
$this->entityManager = $entityManager;
$this->userStore = $userStore;
$this->userSolver = $userSolver;
$this->userFactory = $userFactory;
}


public function create( string $email, string $password, array $roles=[])
{
$user = $this->userFactory->create();
$user->setEmail($email);
$user->setPassword($password);

$user->setRoles($roles);
$this->entityManager->create($user);
$this->entityManager->flush();

return $user;

}

public function setNewsletter(UserInterface $user, NewsletterInterface $newsletter, bool $subscribeNewsletter): void
@@ -41,6 +60,7 @@ class UserBuilder

return $entity;
}

public function initBlameableUpdatedSystem(EntityInterface $entity)
{
$userSystem = $this->userStore->getOneByDevAlias('system');

+ 2
- 1
Resources/translations/admin.fr.yaml View File

@@ -16,7 +16,8 @@ title:
index: '%label_plurial%'
sort: Ordonner "%label_plurial%"
new: Ajouter "%label%"
edit: Modifier "%label%" (#%id%)
edit: 'Modifier "%label%" (#%id%)'
editWithTitle: 'Modifier "%label%" : %title% (#%id%)'
detail: Voir "%label%" (#%id%)
un_titre: Un titre
account:

+ 6
- 1
Resources/views/adminlte/crud/form.html.twig View File

@@ -16,7 +16,12 @@

{% set body_id = 'ea-edit-' ~ translation_entity_name ~ '-' ~ entity.primaryKeyValue %}
{% set body_class = 'ea-edit ea-edit-' ~ translation_entity_name %}
{% set content_title = 'edit'|sov_trans_admin_title(translation_entity_name, {id: ea.getEntity().getInstance().getId()}) %}
{% if attribute(ea.getEntity().getInstance(), 'getTitle') is defined %}
{% set content_title = 'editWithTitle'|sov_trans_admin_title(translation_entity_name, {id: ea.getEntity().getInstance().getId(), title: ea.getEntity().getInstance().getTitle()}) %}
{% else %}
{% set content_title = 'edit'|sov_trans_admin_title(translation_entity_name, {id: ea.getEntity().getInstance().getId()}) %}

{% endif %}
{% endif %}



+ 4
- 0
Translation/TranslatorAdmin.php View File

@@ -137,6 +137,10 @@ class TranslatorAdmin
$paramsTranslation['%id%'] = $params['id'];
}

if (isset($params['title'])) {
$paramsTranslation['%title%'] = $params['title'];
}

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

Loading…
Cancel
Save