mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Feature: Add new field ccuser in workflow step entity
This commit is contained in:
parent
331443ae12
commit
cbc3ee68b5
@ -32,6 +32,12 @@ class EntityWorkflowStep
|
|||||||
*/
|
*/
|
||||||
private string $accessKey;
|
private string $accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ORM\ManyToMany(targetEntity=User::class)
|
||||||
|
* @ORM\JoinTable(name="chill_main_workflow_entity_step_cc_user")
|
||||||
|
*/
|
||||||
|
private Collection $ccUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="text", options={"default": ""})
|
* @ORM\Column(type="text", options={"default": ""})
|
||||||
*/
|
*/
|
||||||
@ -114,6 +120,7 @@ class EntityWorkflowStep
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->ccUser = new ArrayCollection();
|
||||||
$this->destUser = new ArrayCollection();
|
$this->destUser = new ArrayCollection();
|
||||||
$this->destUserByAccessKey = new ArrayCollection();
|
$this->destUserByAccessKey = new ArrayCollection();
|
||||||
$this->accessKey = bin2hex(openssl_random_pseudo_bytes(32));
|
$this->accessKey = bin2hex(openssl_random_pseudo_bytes(32));
|
||||||
@ -128,6 +135,15 @@ class EntityWorkflowStep
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function addCcUser(User $user): self
|
||||||
|
{
|
||||||
|
if (!$this->ccUser->contains($user)) {
|
||||||
|
$this->ccUser[] = $user;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function addDestUser(User $user): self
|
public function addDestUser(User $user): self
|
||||||
{
|
{
|
||||||
if (!$this->destUser->contains($user)) {
|
if (!$this->destUser->contains($user)) {
|
||||||
@ -167,6 +183,11 @@ class EntityWorkflowStep
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCcUser(): Collection
|
||||||
|
{
|
||||||
|
return $this->ccUser;
|
||||||
|
}
|
||||||
|
|
||||||
public function getComment(): string
|
public function getComment(): string
|
||||||
{
|
{
|
||||||
return $this->comment;
|
return $this->comment;
|
||||||
@ -261,6 +282,13 @@ class EntityWorkflowStep
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function removeCcUser(User $user): self
|
||||||
|
{
|
||||||
|
$this->ccUser->removeElement($user);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function removeDestEmail(string $email): self
|
public function removeDestEmail(string $email): self
|
||||||
{
|
{
|
||||||
$this->destEmail = array_filter($this->destEmail, static function (string $existing) use ($email) {
|
$this->destEmail = array_filter($this->destEmail, static function (string $existing) use ($email) {
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\Migrations\Main;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20230321134155 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user DROP CONSTRAINT FK_9FC79037E6AF9D4');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user DROP CONSTRAINT FK_9FC7903A76ED395');
|
||||||
|
$this->addSql('DROP TABLE chill_main_workflow_entity_step_cc_user');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add cc User to workflow step';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('CREATE TABLE chill_main_workflow_entity_step_cc_user (entityworkflowstep_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(entityworkflowstep_id, user_id))');
|
||||||
|
$this->addSql('CREATE INDEX IDX_9FC79037E6AF9D4 ON chill_main_workflow_entity_step_cc_user (entityworkflowstep_id)');
|
||||||
|
$this->addSql('CREATE INDEX IDX_9FC7903A76ED395 ON chill_main_workflow_entity_step_cc_user (user_id)');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user ADD CONSTRAINT FK_9FC79037E6AF9D4 FOREIGN KEY (entityworkflowstep_id) REFERENCES chill_main_workflow_entity_step (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE chill_main_workflow_entity_step_cc_user ADD CONSTRAINT FK_9FC7903A76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user