add accessKey to entity workflow step

This commit is contained in:
2022-02-23 18:33:29 +01:00
parent b56d8c2956
commit 08f9819453
3 changed files with 54 additions and 2 deletions

View File

@@ -86,7 +86,7 @@ class EntityWorkflowStep
private ?string $transitionAfter = null;
/**
* @ORM\Column(type="datetime_immutable")
* @ORM\Column(type="datetime_immutable", nullable=true, options={"default": null})
*/
private ?DateTimeImmutable $transitionAt = null;
@@ -101,9 +101,15 @@ class EntityWorkflowStep
*/
private ?string $transitionByEmail = null;
/**
* @ORM\Column(type="text", nullable=false)
*/
private string $accessKey;
public function __construct()
{
$this->destUser = new ArrayCollection();
$this->accessKey = bin2hex(openssl_random_pseudo_bytes(32));
}
public function addDestEmail(string $email): self
@@ -119,6 +125,9 @@ class EntityWorkflowStep
{
if (!$this->destUser->contains($user)) {
$this->destUser[] = $user;
$this->getEntityWorkflow()
->addSubscriberToFinal($user)
->addSubscriberToStep($user);
}
return $this;