|
@@ -422,9 +422,30 @@ class Access implements UserInterface, PasswordAuthenticatedUserInterface
|
|
|
#[Groups(['my_access:input'])]
|
|
#[Groups(['my_access:input'])]
|
|
|
public function setHistorical(array $historical): self
|
|
public function setHistorical(array $historical): self
|
|
|
{
|
|
{
|
|
|
- if (!$historical['past'] && !$historical['present'] && !$historical['future']) {
|
|
|
|
|
|
|
+ // Une entrée dateStart mais pas de dateEnd, on retire dateEnd
|
|
|
|
|
+ if (array_key_exists('dateStart', $historical) && !array_key_exists('dateEnd', $historical)) {
|
|
|
|
|
+ unset($historical['dateStart']);
|
|
|
|
|
+ }
|
|
|
|
|
+ // Une entrée dateEnd mais pas de dateStart, on retire dateEnd
|
|
|
|
|
+ else if (!array_key_exists('dateStart', $historical) && array_key_exists('dateEnd', $historical)) {
|
|
|
|
|
+ unset($historical['dateEnd']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Les entrées dateStart et dateEnd existent mais ne sont pas toutes les deux renseignées, on retire les deux
|
|
|
|
|
+ if (
|
|
|
|
|
+ array_key_exists('dateStart', $historical) &&
|
|
|
|
|
+ array_key_exists('dateEnd', $historical) &&
|
|
|
|
|
+ (!$historical['dateStart'] || !$historical['dateEnd'])
|
|
|
|
|
+ ) {
|
|
|
|
|
+ unset($historical['dateStart']);
|
|
|
|
|
+ unset($historical['dateEnd']);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Aucun temps ni période n'est défini, on définit par défaut present à vrai
|
|
|
|
|
+ if (!$historical['past'] && !$historical['present'] && !$historical['future'] && !array_key_exists('dateStart', $historical) ) {
|
|
|
$historical['present'] = true;
|
|
$historical['present'] = true;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
$this->setting['historical'] = $historical;
|
|
$this->setting['historical'] = $historical;
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|