diff options
Diffstat (limited to 'src/model/entities/Email.php')
| -rw-r--r-- | src/model/entities/Email.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/model/entities/Email.php b/src/model/entities/Email.php index ff76653..60fcc1f 100644 --- a/src/model/entities/Email.php +++ b/src/model/entities/Email.php | |||
| @@ -48,18 +48,18 @@ class Email | |||
| 48 | #[ORM\Column(type: 'datetime', nullable: true)] | 48 | #[ORM\Column(type: 'datetime', nullable: true)] |
| 49 | private ?\DateTime $is_sensitive_since; | 49 | private ?\DateTime $is_sensitive_since; |
| 50 | 50 | ||
| 51 | #[ORM\ManyToOne(targetEntity: NodeData::class)] | 51 | #[ORM\ManyToOne(targetEntity: EmailForm::class)] |
| 52 | #[ORM\JoinColumn(name: "node_data_id", referencedColumnName: "id_node_data", nullable: true)] | 52 | #[ORM\JoinColumn(name: "email_form_id", referencedColumnName: "id_email_form", nullable: true)] |
| 53 | private ?NodeData $node_data; | 53 | private ?EmailForm $email_form; |
| 54 | 54 | ||
| 55 | public function __construct(string $sender_name, string $sender_address, string $recipient, string $content, NodeData $node_data, bool $sensitive = false){ | 55 | public function __construct(string $sender_name, string $sender_address, string $recipient, string $content, EmailForm $email_form, bool $sensitive = false){ |
| 56 | $this->sender_name = strtolower($sender_name); | 56 | $this->sender_name = strtolower($sender_name); |
| 57 | $this->sender_address = strtolower($sender_address); | 57 | $this->sender_address = strtolower($sender_address); |
| 58 | $this->recipient = strtolower($recipient); | 58 | $this->recipient = strtolower($recipient); |
| 59 | $this->content = $content; | 59 | $this->content = $content; |
| 60 | $this->date_time = new \DateTime; | 60 | $this->date_time = new \DateTime; |
| 61 | $this->last_contact_date = new \DateTime; | 61 | $this->last_contact_date = new \DateTime; |
| 62 | $this->node_data = $node_data; | 62 | $this->email_form = $email_form; |
| 63 | $this->makeSensitive($sensitive); | 63 | $this->makeSensitive($sensitive); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| @@ -113,14 +113,14 @@ class Email | |||
| 113 | $this->last_contact_date = new \DateTime; | 113 | $this->last_contact_date = new \DateTime; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | public function getDeletionDate(): \DateTime // utilise une durée de conservation $period qui est propre au bloc formulaire (à son NodeData) | 116 | public function getDeletionDate(): \DateTime // utilise une durée de conservation $period qui est propre au bloc formulaire (à son EmailForm) |
| 117 | { | 117 | { |
| 118 | // tests appliqués: | 118 | // tests appliqués: |
| 119 | // => e-mail associé à un formulaire? | 119 | // => e-mail associé à un formulaire? |
| 120 | // => ce formulaire dispose d'une durée de stockage spécifique? | 120 | // => ce formulaire dispose d'une durée de stockage spécifique? |
| 121 | // => cette donnée est un entier > 0 | 121 | // => cette donnée est un entier > 0 |
| 122 | $key = $this->is_sensitive ? 'retention_period_sensible' : 'retention_period'; | 122 | $key = $this->is_sensitive ? 'retention_period_sensible' : 'retention_period'; |
| 123 | $period = $this->node_data ? (int)($this->node_data->getData()[$key] ?? null) : null; | 123 | $period = $this->email_form ? (int)($this->email_form->getData()[$key] ?? null) : null; |
| 124 | 124 | ||
| 125 | $default = $this->is_sensitive ? self::DEFAULT_RETENTION_PERIOD_SENSITIVE : self::DEFAULT_RETENTION_PERIOD; | 125 | $default = $this->is_sensitive ? self::DEFAULT_RETENTION_PERIOD_SENSITIVE : self::DEFAULT_RETENTION_PERIOD; |
| 126 | $period = ($period === null || $period <= 0) ? $default : $period; | 126 | $period = ($period === null || $period <= 0) ? $default : $period; |
