mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
WIP [centerHistory] Try to get test to work for personCenterHistory
This commit is contained in:
@@ -4,11 +4,11 @@ namespace Chill\PersonBundle\Actions\Remove\Handler;
|
||||
|
||||
use Chill\PersonBundle\Actions\Remove\PersonMoveSqlHandlerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Chill\PersonBundle\Repository\Person\PersonCenterHistoryRepository;
|
||||
|
||||
class PersonMoveCenterHistoryHandler implements PersonMoveSqlHandlerInterface
|
||||
{
|
||||
public function __construct(private EntityManagerInterface $em)
|
||||
public function __construct(private PersonCenterHistoryRepository $centerHistoryRepository)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,15 +23,13 @@ class PersonMoveCenterHistoryHandler implements PersonMoveSqlHandlerInterface
|
||||
$oldestDateA = null;
|
||||
$oldestDateB = null;
|
||||
|
||||
$centerHistoriesA = $this->em->getRepository(Person\PersonCenterHistory::class)->findBy(['person' => $from->getId()]);
|
||||
// $centerHistoriesA = $from->getCenterHistory()->toArray();
|
||||
$centerHistoriesA = $this->centerHistoryRepository->findBy(['person' => $from]);
|
||||
$datesArrayA = array_map(fn($centerHistory) => $centerHistory->getStartDate(), $centerHistoriesA);
|
||||
if (!count($datesArrayA) === 0) {
|
||||
$oldestDateA = min($datesArrayA);
|
||||
}
|
||||
|
||||
$centerHistoriesB = $this->em->getRepository(Person\PersonCenterHistory::class)->findBy(['person' => $to->getId()]);
|
||||
// $centerHistoriesB = $to->getCenterHistory()->toArray();
|
||||
$centerHistoriesB = $this->centerHistoryRepository->findBy(['person' => $to]);
|
||||
$datesArrayB = array_map(fn($centerHistory) => $centerHistory->getStartDate(), $centerHistoriesB);
|
||||
|
||||
if (!count($datesArrayB) === 0) {
|
||||
|
Reference in New Issue
Block a user