mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/master' into bootstrap-api
This commit is contained in:
@@ -39,22 +39,16 @@ 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
|
||||
*
|
||||
* @package Chill\PersonBundle\Controller
|
||||
*/
|
||||
class PersonController extends AbstractController
|
||||
final class PersonController extends AbstractController
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var SimilarPersonMatcher
|
||||
*/
|
||||
protected $similarPersonMatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var TranslatorInterface
|
||||
*/
|
||||
protected $translator;
|
||||
@@ -65,35 +59,39 @@ class PersonController extends AbstractController
|
||||
protected $eventDispatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var PersonRepository;
|
||||
*/
|
||||
protected $personRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var ConfigPersonAltNamesHelper
|
||||
*/
|
||||
protected $configPersonAltNameHelper;
|
||||
|
||||
/**
|
||||
* @var EntityManagerInterface
|
||||
*/
|
||||
private $em;
|
||||
|
||||
/**
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
private $logger;
|
||||
|
||||
|
||||
/**
|
||||
* @var ValidatorInterface
|
||||
*/
|
||||
private $validator;
|
||||
|
||||
public function __construct(
|
||||
public function __construct(
|
||||
SimilarPersonMatcher $similarPersonMatcher,
|
||||
TranslatorInterface $translator,
|
||||
EventDispatcherInterface $eventDispatcher,
|
||||
PersonRepository $personRepository,
|
||||
ConfigPersonAltNamesHelper $configPersonAltNameHelper,
|
||||
LoggerInterface $logger,
|
||||
ValidatorInterface $validator
|
||||
ValidatorInterface $validator,
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$this->similarPersonMatcher = $similarPersonMatcher;
|
||||
$this->translator = $translator;
|
||||
@@ -102,14 +100,14 @@ class PersonController extends AbstractController
|
||||
$this->personRepository = $personRepository;
|
||||
$this->logger = $logger;
|
||||
$this->validator = $validator;
|
||||
$this->em = $em;
|
||||
}
|
||||
|
||||
public function getCFGroup()
|
||||
{
|
||||
$cFGroup = null;
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$cFDefaultGroup = $em->getRepository("ChillCustomFieldsBundle:CustomFieldsDefaultGroup")
|
||||
$cFDefaultGroup = $this->em->getRepository("ChillCustomFieldsBundle:CustomFieldsDefaultGroup")
|
||||
->findOneByEntity("Chill\PersonBundle\Entity\Person");
|
||||
|
||||
if($cFDefaultGroup) {
|
||||
@@ -198,8 +196,7 @@ class PersonController extends AbstractController
|
||||
->trans('The person data has been updated')
|
||||
);
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->flush();
|
||||
$this->em->flush();
|
||||
|
||||
$url = $this->generateUrl('chill_person_view', array(
|
||||
'person_id' => $person->getId()
|
||||
@@ -343,6 +340,8 @@ class PersonController extends AbstractController
|
||||
$this->logger->info('Person created without errors');
|
||||
}
|
||||
|
||||
$this->em->persist($person);
|
||||
|
||||
$alternatePersons = $this->similarPersonMatcher
|
||||
->matchPerson($person);
|
||||
|
||||
@@ -391,11 +390,9 @@ class PersonController extends AbstractController
|
||||
'You are not allowed to create this person');
|
||||
|
||||
if ($errors->count() === 0) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$this->em->persist($person);
|
||||
|
||||
$em->persist($person);
|
||||
|
||||
$em->flush();
|
||||
$this->em->flush();
|
||||
|
||||
return $this->redirect($this->generateUrl('chill_person_general_edit',
|
||||
array('person_id' => $person->getId())));
|
||||
|
Reference in New Issue
Block a user