mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
FEATURE [absence][in_progress] add absence property to user, create form, controller, template, migration and menu entry
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\AdvancedUserInterface;
|
||||
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 AdvancedUserInterface
|
||||
*/
|
||||
protected ?int $id = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private ?DateTimeImmutable $absenceStart = null;
|
||||
|
||||
/**
|
||||
* Array where SAML attributes's data are stored.
|
||||
*
|
||||
@@ -175,6 +181,11 @@ class User implements AdvancedUserInterface
|
||||
{
|
||||
}
|
||||
|
||||
public function getAbsenceStart(): ?DateTimeImmutable
|
||||
{
|
||||
return $this->absenceStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get attributes.
|
||||
*
|
||||
@@ -295,6 +306,11 @@ class User implements AdvancedUserInterface
|
||||
return $this->usernameCanonical;
|
||||
}
|
||||
|
||||
public function isAbsent(): bool
|
||||
{
|
||||
return null !== $this->getAbsenceStart() ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -359,6 +375,11 @@ class User implements AdvancedUserInterface
|
||||
}
|
||||
}
|
||||
|
||||
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