feat: add entities

This commit is contained in:
Maël Gangloff
2024-07-10 23:30:59 +02:00
parent d0f8a220bd
commit cbaca7bf6a
12 changed files with 860 additions and 0 deletions

161
src/Entity/Domain.php Normal file
View File

@@ -0,0 +1,161 @@
<?php
namespace App\Entity;
use App\Repository\DomainRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DomainRepository::class)]
class Domain
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $ldhname = null;
#[ORM\Column(length: 255)]
private ?string $handle = null;
#[ORM\Column(type: Types::ARRAY)]
private array $status = [];
/**
* @var Collection<int, Event>
*/
#[ORM\OneToMany(targetEntity: Event::class, mappedBy: 'domain', orphanRemoval: true)]
private Collection $events;
/**
* @var Collection<int, DomainEntity>
*/
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'domain', orphanRemoval: true)]
private Collection $domainEntities;
#[ORM\Column(length: 255)]
private ?string $whoisStatus = null;
public function __construct()
{
$this->events = new ArrayCollection();
$this->domainEntities = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getLdhname(): ?string
{
return $this->ldhname;
}
public function setLdhname(string $ldhname): static
{
$this->ldhname = $ldhname;
return $this;
}
public function getHandle(): ?string
{
return $this->handle;
}
public function setHandle(string $handle): static
{
$this->handle = $handle;
return $this;
}
public function getStatus(): array
{
return $this->status;
}
public function setStatus(array $status): static
{
$this->status = $status;
return $this;
}
/**
* @return Collection<int, Event>
*/
public function getEvents(): Collection
{
return $this->events;
}
public function addEvent(Event $event): static
{
if (!$this->events->contains($event)) {
$this->events->add($event);
$event->setDomain($this);
}
return $this;
}
public function removeEvent(Event $event): static
{
if ($this->events->removeElement($event)) {
// set the owning side to null (unless already changed)
if ($event->getDomain() === $this) {
$event->setDomain(null);
}
}
return $this;
}
/**
* @return Collection<int, DomainEntity>
*/
public function getDomainEntities(): Collection
{
return $this->domainEntities;
}
public function addDomainEntity(DomainEntity $domainEntity): static
{
if (!$this->domainEntities->contains($domainEntity)) {
$this->domainEntities->add($domainEntity);
$domainEntity->setDomain($this);
}
return $this;
}
public function removeDomainEntity(DomainEntity $domainEntity): static
{
if ($this->domainEntities->removeElement($domainEntity)) {
// set the owning side to null (unless already changed)
if ($domainEntity->getDomain() === $this) {
$domainEntity->setDomain(null);
}
}
return $this;
}
public function getWhoisStatus(): ?string
{
return $this->whoisStatus;
}
public function setWhoisStatus(string $whoisStatus): static
{
$this->whoisStatus = $whoisStatus;
return $this;
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace App\Entity;
use App\Repository\DomainEntityRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DomainEntityRepository::class)]
class DomainEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'domainEntities')]
#[ORM\JoinColumn(nullable: false)]
private ?Domain $domain = null;
#[ORM\ManyToOne(inversedBy: 'domainEntities')]
#[ORM\JoinColumn(nullable: false)]
private ?Entity $entity = null;
#[ORM\Column(length: 255)]
private ?string $roles = null;
public function getId(): ?int
{
return $this->id;
}
public function getDomain(): ?Domain
{
return $this->domain;
}
public function setDomain(?Domain $domain): static
{
$this->domain = $domain;
return $this;
}
public function getEntity(): ?Entity
{
return $this->entity;
}
public function setEntity(?Entity $entity): static
{
$this->entity = $entity;
return $this;
}
public function getRoles(): ?string
{
return $this->roles;
}
public function setRoles(string $roles): static
{
$this->roles = $roles;
return $this;
}
}

115
src/Entity/Entity.php Normal file
View File

@@ -0,0 +1,115 @@
<?php
namespace App\Entity;
use App\Repository\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EntityRepository::class)]
class Entity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $handle = null;
/**
* @var Collection<int, DomainEntity>
*/
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'entity', orphanRemoval: true)]
private Collection $domainEntities;
/**
* @var Collection<int, NameserverEntity>
*/
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'entity')]
private Collection $nameserverEntities;
public function __construct()
{
$this->domainEntities = new ArrayCollection();
$this->nameserverEntities = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getHandle(): ?string
{
return $this->handle;
}
public function setHandle(string $handle): static
{
$this->handle = $handle;
return $this;
}
/**
* @return Collection<int, DomainEntity>
*/
public function getDomainEntities(): Collection
{
return $this->domainEntities;
}
public function addDomainEntity(DomainEntity $domainEntity): static
{
if (!$this->domainEntities->contains($domainEntity)) {
$this->domainEntities->add($domainEntity);
$domainEntity->setEntity($this);
}
return $this;
}
public function removeDomainEntity(DomainEntity $domainEntity): static
{
if ($this->domainEntities->removeElement($domainEntity)) {
// set the owning side to null (unless already changed)
if ($domainEntity->getEntity() === $this) {
$domainEntity->setEntity(null);
}
}
return $this;
}
/**
* @return Collection<int, NameserverEntity>
*/
public function getNameserverEntities(): Collection
{
return $this->nameserverEntities;
}
public function addNameserverEntity(NameserverEntity $nameserverEntity): static
{
if (!$this->nameserverEntities->contains($nameserverEntity)) {
$this->nameserverEntities->add($nameserverEntity);
$nameserverEntity->setEntity($this);
}
return $this;
}
public function removeNameserverEntity(NameserverEntity $nameserverEntity): static
{
if ($this->nameserverEntities->removeElement($nameserverEntity)) {
// set the owning side to null (unless already changed)
if ($nameserverEntity->getEntity() === $this) {
$nameserverEntity->setEntity(null);
}
}
return $this;
}
}

67
src/Entity/Event.php Normal file
View File

@@ -0,0 +1,67 @@
<?php
namespace App\Entity;
use App\Repository\EventRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EventRepository::class)]
class Event
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $action = null;
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
private ?\DateTimeImmutable $date = null;
#[ORM\ManyToOne(inversedBy: 'events')]
#[ORM\JoinColumn(nullable: false)]
private ?Domain $domain = null;
public function getId(): ?int
{
return $this->id;
}
public function getAction(): ?string
{
return $this->action;
}
public function setAction(string $action): static
{
$this->action = $action;
return $this;
}
public function getDate(): ?\DateTimeImmutable
{
return $this->date;
}
public function setDate(\DateTimeImmutable $date): static
{
$this->date = $date;
return $this;
}
public function getDomain(): ?Domain
{
return $this->domain;
}
public function setDomain(?Domain $domain): static
{
$this->domain = $domain;
return $this;
}
}

109
src/Entity/Nameserver.php Normal file
View File

@@ -0,0 +1,109 @@
<?php
namespace App\Entity;
use App\Repository\NameserverRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: NameserverRepository::class)]
class Nameserver
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $handle = null;
#[ORM\Column(length: 255)]
private ?string $ldhname = null;
/**
* @var Collection<int, NameserverEntity>
*/
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'nameserver', orphanRemoval: true)]
private Collection $nameserverEntities;
#[ORM\Column(type: Types::ARRAY)]
private array $status = [];
public function __construct()
{
$this->nameserverEntities = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getHandle(): ?string
{
return $this->handle;
}
public function setHandle(string $handle): static
{
$this->handle = $handle;
return $this;
}
public function getLdhname(): ?string
{
return $this->ldhname;
}
public function setLdhname(string $ldhname): static
{
$this->ldhname = $ldhname;
return $this;
}
/**
* @return Collection<int, NameserverEntity>
*/
public function getNameserverEntities(): Collection
{
return $this->nameserverEntities;
}
public function addNameserverEntity(NameserverEntity $nameserverEntity): static
{
if (!$this->nameserverEntities->contains($nameserverEntity)) {
$this->nameserverEntities->add($nameserverEntity);
$nameserverEntity->setNameserver($this);
}
return $this;
}
public function removeNameserverEntity(NameserverEntity $nameserverEntity): static
{
if ($this->nameserverEntities->removeElement($nameserverEntity)) {
// set the owning side to null (unless already changed)
if ($nameserverEntity->getNameserver() === $this) {
$nameserverEntity->setNameserver(null);
}
}
return $this;
}
public function getStatus(): array
{
return $this->status;
}
public function setStatus(array $status): static
{
$this->status = $status;
return $this;
}
}

View File

@@ -0,0 +1,83 @@
<?php
namespace App\Entity;
use App\Repository\NameserverEntityRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: NameserverEntityRepository::class)]
class NameserverEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne(inversedBy: 'nameserverEntities')]
#[ORM\JoinColumn(nullable: false)]
private ?Nameserver $nameserver = null;
#[ORM\ManyToOne(inversedBy: 'nameserverEntities')]
#[ORM\JoinColumn(nullable: false)]
private ?Entity $entity = null;
#[ORM\Column(type: Types::ARRAY)]
private array $roles = [];
#[ORM\Column(type: Types::ARRAY)]
private array $status = [];
public function getId(): ?int
{
return $this->id;
}
public function getNameserver(): ?Nameserver
{
return $this->nameserver;
}
public function setNameserver(?Nameserver $nameserver): static
{
$this->nameserver = $nameserver;
return $this;
}
public function getEntity(): ?Entity
{
return $this->entity;
}
public function setEntity(?Entity $entity): static
{
$this->entity = $entity;
return $this;
}
public function getRoles(): array
{
return $this->roles;
}
public function setRoles(array $roles): static
{
$this->roles = $roles;
return $this;
}
public function getStatus(): array
{
return $this->status;
}
public function setStatus(array $status): static
{
$this->status = $status;
return $this;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\DomainEntity;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<DomainEntity>
*/
class DomainEntityRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, DomainEntity::class);
}
// /**
// * @return DomainEntity[] Returns an array of DomainEntity objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?DomainEntity
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Domain;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Domain>
*/
class DomainRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Domain::class);
}
// /**
// * @return Domain[] Returns an array of Domain objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('d.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Domain
// {
// return $this->createQueryBuilder('d')
// ->andWhere('d.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Entity;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Entity>
*/
class EntityRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Entity::class);
}
// /**
// * @return Entity[] Returns an array of Entity objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('e.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Entity
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Event;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Event>
*/
class EventRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Event::class);
}
// /**
// * @return Event[] Returns an array of Event objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('e.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Event
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\NameserverEntity;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<NameserverEntity>
*/
class NameserverEntityRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, NameserverEntity::class);
}
// /**
// * @return NameserverEntity[] Returns an array of NameserverEntity objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('n')
// ->andWhere('n.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('n.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?NameserverEntity
// {
// return $this->createQueryBuilder('n')
// ->andWhere('n.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Repository;
use App\Entity\Nameserver;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Nameserver>
*/
class NameserverRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Nameserver::class);
}
// /**
// * @return Nameserver[] Returns an array of Nameserver objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('n')
// ->andWhere('n.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('n.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Nameserver
// {
// return $this->createQueryBuilder('n')
// ->andWhere('n.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}