- Basic HTML templates
- Created entities & new migration - Added packages symfony/stimulus-bundle & symfony/webpack-encore-bundle
This commit is contained in:
+81
-6
@@ -3,6 +3,9 @@
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\DomainRepository;
|
||||
use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Mapping\Annotation\Timestampable;
|
||||
@@ -32,11 +35,23 @@ class Domain
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
#[Timestampable(on: "update")]
|
||||
private ?\DateTimeInterface $updatedAt = null;
|
||||
private ?DateTimeInterface $updatedAt = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE)]
|
||||
#[Timestampable(on: "create")]
|
||||
private ?\DateTimeInterface $createdAt = null;
|
||||
private ?DateTimeInterface $createdAt = null;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'domain', targetEntity: Comment::class)]
|
||||
private Collection $comments;
|
||||
|
||||
#[ORM\OneToMany(mappedBy: 'domain', targetEntity: DomainPage::class)]
|
||||
private Collection $domainPages;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->comments = new ArrayCollection();
|
||||
$this->domainPages = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
@@ -103,27 +118,87 @@ class Domain
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUpdatedAt(): ?\DateTimeInterface
|
||||
public function getUpdatedAt(): ?DateTimeInterface
|
||||
{
|
||||
return $this->updatedAt;
|
||||
}
|
||||
|
||||
public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
|
||||
public function setUpdatedAt(?DateTimeInterface $updatedAt): static
|
||||
{
|
||||
$this->updatedAt = $updatedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedAt(): ?\DateTimeInterface
|
||||
public function getCreatedAt(): ?DateTimeInterface
|
||||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function setCreatedAt(\DateTimeInterface $createdAt): static
|
||||
public function setCreatedAt(DateTimeInterface $createdAt): static
|
||||
{
|
||||
$this->createdAt = $createdAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Comment>
|
||||
*/
|
||||
public function getComments(): Collection
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function addComment(Comment $comment): static
|
||||
{
|
||||
if (!$this->comments->contains($comment)) {
|
||||
$this->comments->add($comment);
|
||||
$comment->setDomain($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeComment(Comment $comment): static
|
||||
{
|
||||
if ($this->comments->removeElement($comment)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($comment->getDomain() === $this) {
|
||||
$comment->setDomain(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, DomainPage>
|
||||
*/
|
||||
public function getDomainPages(): Collection
|
||||
{
|
||||
return $this->domainPages;
|
||||
}
|
||||
|
||||
public function addDomainPage(DomainPage $domainPage): static
|
||||
{
|
||||
if (!$this->domainPages->contains($domainPage)) {
|
||||
$this->domainPages->add($domainPage);
|
||||
$domainPage->setDomain($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeDomainPage(DomainPage $domainPage): static
|
||||
{
|
||||
if ($this->domainPages->removeElement($domainPage)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($domainPage->getDomain() === $this) {
|
||||
$domainPage->setDomain(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user