mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
DX: rector apply rules 'symfony up to 4.4
This commit is contained in:
@@ -42,7 +42,7 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
|
||||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
return;
|
||||
/** @var array<int, array<int, 1>> $existing */
|
||||
$existing = [];
|
||||
|
||||
for ($i = 0; 20 > $i; ++$i) {
|
||||
@@ -60,15 +60,16 @@ class LoadRelationships extends Fixture implements DependentFixtureInterface
|
||||
->setUpdatedAt($date);
|
||||
|
||||
// remove the potential duplicates
|
||||
$set = $relationship->getFromPerson()->getId() < $relationship->getToPerson()->getId() ?
|
||||
[$relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()] :
|
||||
[$relationship->getToPerson()->getId(), $relationship->getFromPerson()->getId()];
|
||||
$set = [
|
||||
min($relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()),
|
||||
max($relationship->getFromPerson()->getId(), $relationship->getToPerson()->getId()),
|
||||
];
|
||||
|
||||
if (array_key_exists($set[0], $existing) && array_key_exists($set[1], $existing[$set[0]])) {
|
||||
continue;
|
||||
}
|
||||
$existing[$set[0]][$set[1]] = 1;
|
||||
|
||||
$existing[$set[0]][$existing[$set[1]]] = 1;
|
||||
$manager->persist($relationship);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user