diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index db2b8b9d1..a167dc589 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -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); diff --git a/src/Bundle/ChillPersonBundle/config/services/controller.yaml b/src/Bundle/ChillPersonBundle/config/services/controller.yaml index 24b35a8e3..501291974 100644 --- a/src/Bundle/ChillPersonBundle/config/services/controller.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/controller.yaml @@ -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: