feat: soft-delete for teamer accounts

addresses #869dv9br3
This commit is contained in:
Björn Fromme committed 2026-08-11 12:26:13 +02:00
1 parent 388ecf9603
commit d654ce77fb
45 files changed
+1151 -7

No files matched your search

+19 -1
View File
@@ -2,6 +2,7 @@
namespace App\Entity;
use App\Entity\Traits\SoftDeletableEntity;
use App\Entity\Traits\TimestampableEntity;
use App\Repository\UserRepository;
use Doctrine\DBAL\Types\Types;
@@ -12,9 +13,10 @@ use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
class User implements UserInterface, TimestampableEntityInterface
class User implements UserInterface, TimestampableEntityInterface, SoftDeletableEntityInterface
{
use TimestampableEntity;
use SoftDeletableEntity;
/**
* Assignable roles and their labels.
@@ -315,6 +317,11 @@ class User implements UserInterface, TimestampableEntityInterface
public function setTeamer(?Teamer $teamer): static
{
// keep the inverse side in sync: it is only ever hydrated from the database, so
// without this a teamer attached during the request has no user to point back to
$this->teamer?->setUser(null);
$teamer?->setUser($this);
$this->teamer = $teamer;
return $this;
@@ -408,6 +415,17 @@ class User implements UserInterface, TimestampableEntityInterface
return $this->setDisabledAt(new \DateTimeImmutable());
}
/**
* Whether the account is barred from logging in, for either reason. A block and a
* deletion are independent states: a disciplinary block must survive a deletion and
* the restore that follows it, so the two are only ever combined for decisions,
* never merged into one another.
*/
public function isBlocked(): bool
{
return $this->isDeleted() || $this->isDisabled();
}
public function getDisabledReason(): ?string
{
return $this->disabledReason;