ChillPersonBundle: persist new Persons

This commit is contained in:
Christophe Siraut 2021-04-27 14:42:41 +02:00
parent f02d6df262
commit b43f43fa0b
2 changed files with 13 additions and 1 deletions

View File

@ -39,6 +39,7 @@ use Chill\MainBundle\Search\SearchProvider;
use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Repository\PersonRepository;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\Validator\ValidatorInterface;
use Doctrine\ORM\EntityManagerInterface;
/** /**
* Class PersonController * Class PersonController
@ -76,6 +77,12 @@ class PersonController extends AbstractController
*/ */
protected $configPersonAltNameHelper; protected $configPersonAltNameHelper;
/**
*
* @var EntityManagerInterface
*/
protected $em;
/** /**
* @var \Psr\Log\LoggerInterface * @var \Psr\Log\LoggerInterface
*/ */
@ -93,7 +100,8 @@ class PersonController extends AbstractController
PersonRepository $personRepository, PersonRepository $personRepository,
ConfigPersonAltNamesHelper $configPersonAltNameHelper, ConfigPersonAltNamesHelper $configPersonAltNameHelper,
LoggerInterface $logger, LoggerInterface $logger,
ValidatorInterface $validator ValidatorInterface $validator,
EntityManagerInterface $em
) { ) {
$this->similarPersonMatcher = $similarPersonMatcher; $this->similarPersonMatcher = $similarPersonMatcher;
$this->translator = $translator; $this->translator = $translator;
@ -102,6 +110,7 @@ class PersonController extends AbstractController
$this->personRepository = $personRepository; $this->personRepository = $personRepository;
$this->logger = $logger; $this->logger = $logger;
$this->validator = $validator; $this->validator = $validator;
$this->em = $em;
} }
public function getCFGroup() public function getCFGroup()
@ -343,6 +352,8 @@ class PersonController extends AbstractController
$this->logger->info('Person created without errors'); $this->logger->info('Person created without errors');
} }
$this->em->persist($person);
$alternatePersons = $this->similarPersonMatcher $alternatePersons = $this->similarPersonMatcher
->matchPerson($person); ->matchPerson($person);

View File

@ -8,6 +8,7 @@ services:
$configPersonAltNameHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper' $configPersonAltNameHelper: '@Chill\PersonBundle\Config\ConfigPersonAltNamesHelper'
$logger: '@Psr\Log\LoggerInterface' $logger: '@Psr\Log\LoggerInterface'
$validator: '@Symfony\Component\Validator\Validator\ValidatorInterface' $validator: '@Symfony\Component\Validator\Validator\ValidatorInterface'
$em: '@Doctrine\ORM\EntityManagerInterface'
tags: ['controller.service_arguments'] tags: ['controller.service_arguments']
Chill\PersonBundle\Controller\TimelinePersonController: Chill\PersonBundle\Controller\TimelinePersonController: