|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace CodedMonkey\Dirigent\Doctrine\Entity; |
| 4 | + |
| 5 | +use CodedMonkey\Dirigent\Doctrine\Repository\DistributionRepository; |
| 6 | +use Doctrine\DBAL\Types\Types; |
| 7 | +use Doctrine\ORM\Mapping as ORM; |
| 8 | + |
| 9 | +#[ORM\Entity(repositoryClass: DistributionRepository::class)] |
| 10 | +#[ORM\UniqueConstraint(columns: ['version_id', 'reference', 'type'])] |
| 11 | +class Distribution extends TrackedEntity |
| 12 | +{ |
| 13 | + #[ORM\Column, ORM\GeneratedValue, ORM\Id] |
| 14 | + private ?int $id = null; |
| 15 | + |
| 16 | + #[ORM\ManyToOne(inversedBy: 'distributions')] |
| 17 | + #[ORM\JoinColumn(nullable: false)] |
| 18 | + private ?Version $version = null; |
| 19 | + |
| 20 | + #[ORM\Column] |
| 21 | + private ?string $reference = null; |
| 22 | + |
| 23 | + #[ORM\Column] |
| 24 | + private ?string $type = null; |
| 25 | + |
| 26 | + #[ORM\Column] |
| 27 | + private \DateTimeImmutable $releasedAt; |
| 28 | + |
| 29 | + #[ORM\Column] |
| 30 | + private \DateTimeImmutable $resolvedAt; |
| 31 | + |
| 32 | + /** |
| 33 | + * Source URL. |
| 34 | + * |
| 35 | + * Contains the source URL if the distribution is mirrored. |
| 36 | + */ |
| 37 | + #[ORM\Column(type: Types::TEXT, nullable: true)] |
| 38 | + private ?string $source = null; |
| 39 | + |
| 40 | + public function getId(): ?int |
| 41 | + { |
| 42 | + return $this->id; |
| 43 | + } |
| 44 | + |
| 45 | + public function getVersion(): ?Version |
| 46 | + { |
| 47 | + return $this->version; |
| 48 | + } |
| 49 | + |
| 50 | + public function setVersion(Version $version): void |
| 51 | + { |
| 52 | + $this->version = $version; |
| 53 | + } |
| 54 | + |
| 55 | + public function getReference(): string |
| 56 | + { |
| 57 | + return $this->reference; |
| 58 | + } |
| 59 | + |
| 60 | + public function setReference(string $reference): void |
| 61 | + { |
| 62 | + $this->reference = $reference; |
| 63 | + } |
| 64 | + |
| 65 | + public function getType(): string |
| 66 | + { |
| 67 | + return $this->type; |
| 68 | + } |
| 69 | + |
| 70 | + public function setType(string $type): void |
| 71 | + { |
| 72 | + $this->type = $type; |
| 73 | + } |
| 74 | + |
| 75 | + public function getReleasedAt(): \DateTimeImmutable |
| 76 | + { |
| 77 | + return $this->releasedAt; |
| 78 | + } |
| 79 | + |
| 80 | + public function setReleasedAt(\DateTimeImmutable $releasedAt): void |
| 81 | + { |
| 82 | + $this->releasedAt = $releasedAt; |
| 83 | + } |
| 84 | + |
| 85 | + public function getResolvedAt(): \DateTimeImmutable |
| 86 | + { |
| 87 | + return $this->resolvedAt; |
| 88 | + } |
| 89 | + |
| 90 | + public function setResolvedAt(): void |
| 91 | + { |
| 92 | + $this->resolvedAt = new \DateTimeImmutable(); |
| 93 | + } |
| 94 | + |
| 95 | + public function getSource(): ?string |
| 96 | + { |
| 97 | + return $this->source; |
| 98 | + } |
| 99 | + |
| 100 | + public function setSource(?string $source): void |
| 101 | + { |
| 102 | + $this->source = $source; |
| 103 | + } |
| 104 | +} |
0 commit comments