<?php
namespace App\Entity;
use App\Attribute\Searchable;
use App\Repository\DarkOwlRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Overblog\GraphQLBundle\Annotation\Field;
#[ORM\Entity(repositoryClass: DarkOwlRepository::class)]
class DarkOwl extends BasicEntity
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer")]
#[Field(name: "id", type: "int")]
private $id;
#[ORM\Column(type: "string", length: 255, nullable: true)]
#[Field(name: "title", type: "string")]
#[Searchable(name: 'title')]
private $title;
#[ORM\Column(type: "text")]
#[Field(name: "body", type: "string")]
#[Searchable(name: 'body')]
private $body;
#[ORM\Column(type: "string", length: 255, nullable: true)]
#[Field(name: "source", type: "string")]
#[Searchable(name: 'source')]
private $source;
#[ORM\Column(type: "datetime")]
#[Field(name: "crawl_date", type: "string")]
#[Searchable(name: 'crawl_date')]
private $crawlDate;
#[ORM\Column(type: "float")]
#[Field(name: "hackishness", type: "float")]
private $hackishness;
#[ORM\Column(type: "text")]
#[Field(name: "url", type: "string")]
#[Searchable(name: 'url')]
private $url;
#[ORM\Column(type: "float")]
#[Field(name: "file_size", type: "float")]
private $fileSize;
#[ORM\Column(type: "string", length: 255)]
#[Field(name: "document_id", type: "string")]
#[Searchable(name: 'document_id')]
private $documentID;
#[ORM\ManyToOne(targetEntity: Domain::class, inversedBy: "darkOwls")]
#[ORM\JoinColumn(nullable: false)]
#[Field(name: "domain")]
private $domain;
#[ORM\OneToMany(mappedBy: "darkOwl", targetEntity: LeakEmail::class, cascade: ["persist"], orphanRemoval: true)]
#[Field(name: "emails")]
private $emails;
#[ORM\OneToOne(targetEntity: LeakInfo::class, cascade: ["persist", "remove"])]
#[Field(name: "leak_info")]
private $leakInfo;
public function __construct()
{
$this->emails = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getBody(): ?string
{
return $this->body;
}
public function setBody(string $body): self
{
$this->body = $body;
return $this;
}
public function getSource(): ?string
{
return $this->source;
}
public function setSource(?string $source): self
{
$this->source = $source;
return $this;
}
public function getCrawlDate(): ?\DateTimeInterface
{
return $this->crawlDate;
}
public function setCrawlDate(\DateTimeInterface $crawlDate): self
{
$this->crawlDate = $crawlDate;
return $this;
}
public function getHackishness(): ?float
{
return $this->hackishness;
}
public function setHackishness(float $hackishness): self
{
$this->hackishness = $hackishness;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(string $url): self
{
$this->url = $url;
return $this;
}
public function getFileSize(): ?float
{
return $this->fileSize;
}
public function setFileSize(float $fileSize): self
{
$this->fileSize = $fileSize;
return $this;
}
public function getDocumentID(): ?string
{
return $this->documentID;
}
public function setDocumentID(string $documentID): self
{
$this->documentID = $documentID;
return $this;
}
public function getDomain(): ?Domain
{
return $this->domain;
}
public function setDomain(?Domain $domain): self
{
$this->domain = $domain;
return $this;
}
/**
* @return Collection<int, LeakEmail>
*/
public function getEmails(): Collection
{
return $this->emails;
}
public function addEmail(LeakEmail $email): self
{
if (!$this->emails->contains($email)) {
$this->emails[] = $email;
$email->setDarkOwl($this);
}
return $this;
}
public function removeEmail(LeakEmail $email): self
{
if ($this->emails->removeElement($email)) {
// set the owning side to null (unless already changed)
if ($email->getDarkOwl() === $this) {
$email->setDarkOwl(null);
}
}
return $this;
}
public function getLeakInfo(): ?LeakInfo
{
return $this->leakInfo;
}
public function setLeakInfo(?LeakInfo $leakInfo): self
{
$this->leakInfo = $leakInfo;
return $this;
}
}