Bläddra i källkod

Correctif

develop
Fabien Normand 3 år sedan
förälder
incheckning
82a7e0a969
4 ändrade filer med 33 tillägg och 3 borttagningar
  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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

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

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

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

Laddar…
Avbryt
Spara