Completed
Pull Request — master (#2)
by Jeff
03:11
created

Domain::getDkimSelector()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * This file is part of the mailserver-admin package.
6
 * (c) Jeffrey Boehm <https://github.com/jeboehm/mailserver-admin>
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace App\Entity;
12
13
use Doctrine\Common\Collections\ArrayCollection;
14
use Doctrine\ORM\Mapping as ORM;
15
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
16
use Symfony\Component\Validator\Constraints as Assert;
17
18
/**
19
 * @ORM\Entity(repositoryClass="App\Repository\DomainRepository")
20
 * @ORM\Table(name="mail_domains")
21
 * @UniqueEntity("name")
22
 */
23
class Domain
24
{
25
    /**
26
     * @ORM\Id()
27
     * @ORM\GeneratedValue()
28
     * @ORM\Column(type="integer", name="id")
29
     */
30
    private $id;
31
32
    /**
33
     * @ORM\Column(type="string", name="name", unique=true, options={"collation":"utf8_unicode_ci"})
34
     * @Assert\NotBlank()
35
     */
36
    private $name = '';
37
38
    /**
39
     * @ORM\Column(type="boolean", name="dkim_enabled")
40
     */
41
    private $dkimEnabled = false;
42
43
    /**
44
     * @ORM\Column(type="string", name="dkim_selector")
45
     */
46
    private $dkimSelector = '';
47
48
    /**
49
     * @ORM\Column(type="text", name="dkim_private_key")
50
     */
51
    private $dkimPrivateKey = '';
52
53
    /**
54
     * @ORM\OneToMany(targetEntity="User", mappedBy="domain", cascade={"persist", "remove"}, orphanRemoval=true)
55
     * @Assert\Valid()
56
     */
57
    private $users;
58
59
    /**
60
     * @ORM\OneToMany(targetEntity="Alias", mappedBy="domain", cascade={"persist", "remove"}, orphanRemoval=true)
61
     * @Assert\Valid()
62
     */
63
    private $aliases;
64
65
    public function __construct()
66
    {
67
        $this->users = new ArrayCollection();
68
        $this->aliases = new ArrayCollection();
69
    }
70
71
    public function __toString(): string
72
    {
73
        return $this->name;
74
    }
75
76
    public function getId(): ?int
77
    {
78
        return $this->id;
79
    }
80
81
    public function getName(): string
82
    {
83
        return $this->name;
84
    }
85
86
    public function setName(string $name): void
87
    {
88
        $this->name = $name;
89
    }
90
91
    public function getDkimEnabled(): bool
92
    {
93
        return $this->dkimEnabled;
94
    }
95
96
    public function setDkimEnabled(bool $dkimEnabled): void
97
    {
98
        $this->dkimEnabled = $dkimEnabled;
99
    }
100
101
    public function getDkimSelector(): string
102
    {
103
        return $this->dkimSelector;
104
    }
105
106
    public function setDkimSelector(string $dkimSelector): void
107
    {
108
        $this->dkimSelector = $dkimSelector;
109
    }
110
111
    public function getDkimPrivateKey(): string
112
    {
113
        return $this->dkimPrivateKey;
114
    }
115
116
    public function setDkimPrivateKey(string $dkimPrivateKey): void
117
    {
118
        $this->dkimPrivateKey = $dkimPrivateKey;
119
    }
120
121
    public function getUsers(): iterable
122
    {
123
        return $this->users;
124
    }
125
126
    public function getAliases(): iterable
127
    {
128
        return $this->aliases;
129
    }
130
}
131