From df2480c47c3bbe72be73396736b01445b9689383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 20 Mar 2023 21:36:46 +0100 Subject: [PATCH 1/3] Fixed: transform null value into emtpy string into ThirdParty::setProfession --- src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index b13118168..29565e86a 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -807,10 +807,10 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface /** * @return $this - */ - public function setProfession(string $profession): self + */"" + public function setProfession(?string $profession): self { - $this->profession = $profession; + $this->profession = (string) $profession; return $this; } From ecac40958696e0ad588b8b3a434e95a0c0961397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 20 Mar 2023 21:38:42 +0100 Subject: [PATCH 2/3] fixed: fix 3party syntax --- src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 29565e86a..966e40bd1 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -805,9 +805,6 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface return $this; } - /** - * @return $this - */"" public function setProfession(?string $profession): self { $this->profession = (string) $profession; From a8977729fea74410de53df3939ab1cce9d73f88d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 21 Mar 2023 16:39:31 +0100 Subject: [PATCH 3/3] Fixed: [similar person matcher] properly takes person center into account Center comes from the table person_center_history, not person.center_id --- .../ChillPersonBundle/Search/SimilarPersonMatcher.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php index 6555f7835..b7e2c12b0 100644 --- a/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php +++ b/src/Bundle/ChillPersonBundle/Search/SimilarPersonMatcher.php @@ -76,8 +76,17 @@ class SimilarPersonMatcher $qb->select('p') ->from(Person::class, 'p') + ->join('p.centerHistory', 'center_history') ->where('SIMILARITY(p.fullnameCanonical, UNACCENT(LOWER(:fullName))) >= :precision') - ->andWhere($qb->expr()->in('p.center', ':centers')); + ->andWhere($qb->expr()->in('center_history.center', ':centers')) + ->andWhere($qb->expr()->andX( + $qb->expr()->lte('center_history.startDate', 'CURRENT_DATE()'), + $qb->expr()->orX( + $qb->expr()->isNull('center_history.endDate'), + $qb->expr()->gt('center_history.endDate', 'CURRENT_DATE()') + ) + )) + ; $qb ->setParameter('fullName', $this->personRender->renderString($person, []))