src/Entity/Score.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ScoreRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Overblog\GraphQLBundle\Annotation\Field;
  6. #[ORM\Entity(repositoryClassScoreRepository::class)]
  7. #[ORM\HasLifecycleCallbacks]
  8. class Score extends BasicEntity
  9. {
  10.     public const TYPE_LEAKED_PWD 'LP';
  11.     public const TYPE_VULNERABILITY 'VL';
  12.     public const TYPE_PORT 'PR';
  13.     public const TYPE_ATTACK_SURFACE 'AS';
  14.     public const TYPE_DARK_WEB 'DW';
  15.     public const TYPE_GLOBAL_SCORE 'GS';
  16.     #[ORM\Id]
  17.     #[ORM\GeneratedValue]
  18.     #[ORM\Column]
  19.     #[Field(name"id"type"int")]
  20.     private ?int $id null;
  21.     #[ORM\Column(length255)]
  22.     #[Field(name"type"type"string")]
  23.     private ?string $type null;
  24.     #[ORM\Column]
  25.     #[Field(name"score"type"float")]
  26.     private ?float $score null;
  27.     #[ORM\Column]
  28.     #[Field(name"created_at"type"date")]
  29.     private ?\DateTimeImmutable $createdAt null;
  30.     #[ORM\Column(length255)]
  31.     #[Field(name"label"type"string")]
  32.     private ?string $label null;
  33.     #[ORM\ManyToOne(inversedBy'scores')]
  34.     #[ORM\JoinColumn(nullablefalse)]
  35.     private ?Domain $domain null;
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getType(): ?string
  41.     {
  42.         return $this->type;
  43.     }
  44.     public function setType(string $type): static
  45.     {
  46.         $this->type $type;
  47.         return $this;
  48.     }
  49.     public function getScore(): ?float
  50.     {
  51.         return $this->score;
  52.     }
  53.     public function setScore(float $score): static
  54.     {
  55.         $this->score $score;
  56.         return $this;
  57.     }
  58.     public function getCreatedAt(): ?\DateTimeImmutable
  59.     {
  60.         return $this->createdAt;
  61.     }
  62.     public function forceCreateAt(\DateTimeImmutable $date): static
  63.     {
  64.         $this->createdAt $date;
  65.         return $this;
  66.     }
  67.     #[ORM\PrePersist]
  68.     #[ORM\PreUpdate]
  69.     public function setCreatedAt(): static
  70.     {
  71.         if($this->createdAt === null) {
  72.             $this->createdAt = new \DateTimeImmutable();
  73.         }
  74.         return $this;
  75.     }
  76.     public function getLabel(): ?string
  77.     {
  78.         return $this->label;
  79.     }
  80.     public function setLabel(string $label): static
  81.     {
  82.         $this->label $label;
  83.         return $this;
  84.     }
  85.     public function getDomain(): ?Domain
  86.     {
  87.         return $this->domain;
  88.     }
  89.     public function setDomain(?Domain $domain): static
  90.     {
  91.         $this->domain $domain;
  92.         return $this;
  93.     }
  94. }