mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/master' into integrate_regroupment_entity
This commit is contained in:
@@ -11,14 +11,15 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Entity;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use function in_array;
|
||||
|
||||
/**
|
||||
@@ -40,6 +41,11 @@ class User implements UserInterface
|
||||
*/
|
||||
protected ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
*/
|
||||
private ?DateTimeImmutable $absenceStart = null;
|
||||
|
||||
/**
|
||||
* Array where SAML attributes's data are stored.
|
||||
*
|
||||
@@ -173,6 +179,11 @@ class User implements UserInterface
|
||||
{
|
||||
}
|
||||
|
||||
public function getAbsenceStart(): ?DateTimeImmutable
|
||||
{
|
||||
return $this->absenceStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attributes.
|
||||
*
|
||||
@@ -291,6 +302,11 @@ class User implements UserInterface
|
||||
return $this->usernameCanonical;
|
||||
}
|
||||
|
||||
public function isAbsent(): bool
|
||||
{
|
||||
return null !== $this->getAbsenceStart() && $this->getAbsenceStart() <= new DateTimeImmutable('now');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -355,6 +371,11 @@ class User implements UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function setAbsenceStart(?DateTimeImmutable $absenceStart): void
|
||||
{
|
||||
$this->absenceStart = $absenceStart;
|
||||
}
|
||||
|
||||
public function setAttributeByDomain(string $domain, string $key, $value): self
|
||||
{
|
||||
$this->attributes[$domain][$key] = $value;
|
||||
|
Reference in New Issue
Block a user