2025-09-10 22:17:19 +02:00
< ? php
namespace App\Entity ;
2025-09-15 23:04:28 +02:00
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter ;
use ApiPlatform\Metadata\ApiFilter ;
use ApiPlatform\Metadata\ApiResource ;
use ApiPlatform\Metadata\GetCollection ;
2025-09-10 22:17:19 +02:00
use App\Config\RegistrarStatus ;
2025-09-15 23:04:28 +02:00
use App\Repository\IcannAccreditationRepository ;
use Doctrine\Common\Collections\ArrayCollection ;
use Doctrine\Common\Collections\Collection ;
2025-09-10 22:17:19 +02:00
use Doctrine\DBAL\Types\Types ;
use Doctrine\ORM\Mapping as ORM ;
2025-09-10 22:26:02 +02:00
use Symfony\Component\Serializer\Attribute\Groups ;
2025-09-10 22:17:19 +02:00
2025-09-15 23:04:28 +02:00
#[ApiResource(
operations : [
new GetCollection (
uriTemplate : '/icann-accreditations' ,
openapiContext : [
2025-12-07 17:01:21 +01:00
'summary' => 'Retrieve ICANN accreditations' ,
'description' => 'This endpoint allows you to list the accreditations of registrars issued by ICANN. It is also possible to search to retrieve only currently valid accreditations.' ,
2025-09-15 23:04:28 +02:00
'parameters' => [
[
'name' => 'status' ,
'in' => 'query' ,
'required' => true ,
'schema' => [
'type' => 'array' ,
'items' => [
'type' => 'string' ,
'enum' => [ 'Accredited' , 'Terminated' , 'Reserved' ],
],
],
'style' => 'form' ,
'explode' => true ,
'description' => 'Filter by ICANN accreditation status' ,
],
],
],
shortName : 'ICANN Accreditation' ,
description : 'ICANN Registrar IDs list' ,
normalizationContext : [ 'groups' => [ 'icann:list' ]]
),
]
)]
#[ApiFilter(
SearchFilter :: class ,
properties : [
'status' => 'exact' ,
]
)]
#[ORM\Entity(repositoryClass: IcannAccreditationRepository::class)]
2025-11-06 14:27:12 +01:00
#[ORM\Index(name: 'icann_accreditation_status_idx', columns: ['status'])]
2025-09-12 23:34:58 +02:00
class IcannAccreditation
2025-09-10 22:17:19 +02:00
{
2025-09-15 23:04:28 +02:00
#[ORM\Id]
#[ORM\Column]
#[Groups(['icann:item', 'icann:list', 'domain:item'])]
private ? int $id = null ;
2025-09-10 22:17:19 +02:00
#[ORM\Column(length: 255, nullable: true)]
2025-09-15 23:04:28 +02:00
#[Groups(['icann:item', 'icann:list', 'domain:item'])]
2025-09-10 22:17:19 +02:00
private ? string $registrarName = null ;
#[ORM\Column(length: 255, nullable: true)]
2025-09-15 23:04:28 +02:00
#[Groups(['icann:item'])]
2025-09-10 22:17:19 +02:00
private ? string $rdapBaseUrl = null ;
#[ORM\Column(nullable: true, enumType: RegistrarStatus::class)]
2025-09-15 23:04:28 +02:00
#[Groups(['icann:item', 'icann:list', 'domain:item'])]
2025-09-10 22:17:19 +02:00
private ? RegistrarStatus $status = null ;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
2025-09-15 23:04:28 +02:00
#[Groups(['icann:item', 'icann:list', 'domain:item'])]
2025-09-10 22:17:19 +02:00
private ? \DateTimeImmutable $updated = null ;
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
2025-09-15 23:04:28 +02:00
#[Groups(['icann:item', 'icann:list', 'domain:item'])]
2025-09-10 22:17:19 +02:00
private ? \DateTimeImmutable $date = null ;
2025-09-15 23:04:28 +02:00
/**
* @ var Collection < int , Entity >
*/
#[ORM\OneToMany(targetEntity: Entity::class, mappedBy: 'icannAccreditation')]
private Collection $entities ;
public function __construct ()
{
$this -> entities = new ArrayCollection ();
}
2025-09-10 22:17:19 +02:00
public function getRegistrarName () : ? string
{
return $this -> registrarName ;
}
public function setRegistrarName ( ? string $registrarName ) : static
{
$this -> registrarName = $registrarName ;
return $this ;
}
public function getRdapBaseUrl () : ? string
{
return $this -> rdapBaseUrl ;
}
public function setRdapBaseUrl ( ? string $rdapBaseUrl ) : static
{
$this -> rdapBaseUrl = $rdapBaseUrl ;
return $this ;
}
public function getStatus () : ? RegistrarStatus
{
return $this -> status ;
}
public function setStatus ( ? RegistrarStatus $status ) : static
{
$this -> status = $status ;
return $this ;
}
public function getUpdated () : ? \DateTimeImmutable
{
return $this -> updated ;
}
public function setUpdated ( ? \DateTimeImmutable $updated ) : static
{
$this -> updated = $updated ;
return $this ;
}
public function getDate () : ? \DateTimeImmutable
{
return $this -> date ;
}
public function setDate ( ? \DateTimeImmutable $date ) : static
{
$this -> date = $date ;
return $this ;
}
2025-09-15 23:04:28 +02:00
public function getId () : ? int
{
return $this -> id ;
}
public function setId ( ? int $id ) : static
{
$this -> id = $id ;
return $this ;
}
/**
* @ return Collection < int , Entity >
*/
public function getEntities () : Collection
{
return $this -> entities ;
}
public function addEntity ( Entity $entity ) : static
{
if ( ! $this -> entities -> contains ( $entity )) {
$this -> entities -> add ( $entity );
$entity -> setIcannAccreditation ( $this );
}
return $this ;
}
public function removeEntity ( Entity $entity ) : static
{
if ( $this -> entities -> removeElement ( $entity )) {
// set the owning side to null (unless already changed)
if ( $entity -> getIcannAccreditation () === $this ) {
$entity -> setIcannAccreditation ( null );
}
}
return $this ;
}
2025-09-10 22:17:19 +02:00
}