prevent change when syncing from remote

This commit is contained in:
Julien Fastré 2022-06-09 15:44:48 +02:00
parent 64e07c54fa
commit 6e48a042b3
2 changed files with 7 additions and 2 deletions

View File

@ -11,7 +11,6 @@ declare(strict_types=1);
namespace Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\RemoteToLocalSync;
use Chill\CalendarBundle\Entity\Calendar;
use Chill\CalendarBundle\Entity\CalendarRange;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\MachineHttpClient;
use Chill\CalendarBundle\RemoteCalendar\Connector\MSGraph\RemoteEventConverter;
@ -53,6 +52,7 @@ class CalendarRangeSyncer
if (null !== $calendarRange->getCalendar()) {
return;
}
$calendarRange->preventEnqueueChanges = true;
$this->logger->info(__CLASS__ . ' remove a calendar range because deleted on remote calendar');
$this->em->remove($calendarRange);
@ -91,7 +91,9 @@ class CalendarRangeSyncer
->addRemoteAttributes([
'lastModifiedDateTime' => $lastModified->getTimestamp(),
'changeKey' => $new['changeKey'],
]);
])
->preventEnqueueChanges = true
;
}
}
}

View File

@ -167,6 +167,7 @@ JSON;
$calendarRange->getStartDate()->format(\DateTimeImmutable::ATOM));
$this->assertStringContainsString('2022-06-10T17:30:00',
$calendarRange->getEndDate()->format(\DateTimeImmutable::ATOM));
$this->assertTrue($calendarRange->preventEnqueueChanges);
}
public function testDeleteCalendarRangeWithoutAssociation(): void
@ -194,6 +195,7 @@ JSON;
$calendarRange,
$notification['value'][0],
$user);
$this->assertTrue($calendarRange->preventEnqueueChanges);
}
public function testDeleteCalendarRangeWithAssociation(): void
@ -224,5 +226,6 @@ JSON;
$calendarRange,
$notification['value'][0],
$user);
}
}