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

View File

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