<?php
namespace App\Entity;
use App\Utility\GuidUtility;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* @ORM\Entity
*
* @ORM\Table(
* name="blacklistings",
* indexes={
*
* @ORM\Index(name="email_type_idx", columns={"email", "type"})
* }
* )
*/
class Blacklisting
{
public const BLACKLISTING_TYPE_EBAY = 0;
public const BLACKLISTING_TYPE_MAILING = 1;
public const BLACKLISTING_TYPE_REGISTRATION = 2;
public const BLACKLISTING_TYPE_RECRUIT = 3;
public const BLACKLISTING_TYPE_MASS_MAILING = 4;
public const BLACKLISTING_TYPE_JOBRAPIDO = 5;
public const BLACKLISTING_TYPE_JOBLIFT = 6;
public const BLACKLISTING_TYPE_TALENTCOM = 7;
public const BLACKLISTING_TYPE_INDEED = 8;
public const BLACKLISTING_TYPE_KIMETA = 9;
public const BLACKLISTING_TYPE_STELLENONLINE = 10;
public const BLACKLISTING_TYPE_AGENTUR_FUER_ARBEIT = 11;
public const BLACKLISTING_TYPE_ONETIME_LOGIN = 12;
public const BLACKLISTING_TYPE_MEINESTADT = 13;
public const BLACKLISTING_TYPE_JOBIJOBA = 14;
public const BLACKLISTING_TYPE_WHATJOBS = 15;
public const BLACKLISTING_TYPE_SEARCH = 16;
public const BLACKLISTING_TYPE_CONVERSATION_MESSAGES = 17;
public const BLACKLISTING_TYPE_JOOBLE = 18;
public const BLACKLISTING_TYPE_ALLFEEDS = 19;
public const BLACKLISTING_TYPE_STEPSTONE = 20;
public const BLACKLISTING_TYPE_PERSOMATCH = 21;
public const BLACKLISTING_TYPE_XING = 22;
public const BLACKLISTING_TYPES = [
self::BLACKLISTING_TYPE_EBAY,
self::BLACKLISTING_TYPE_MAILING,
self::BLACKLISTING_TYPE_REGISTRATION,
self::BLACKLISTING_TYPE_RECRUIT,
self::BLACKLISTING_TYPE_MASS_MAILING,
self::BLACKLISTING_TYPE_JOBRAPIDO,
self::BLACKLISTING_TYPE_JOBLIFT,
self::BLACKLISTING_TYPE_TALENTCOM,
self::BLACKLISTING_TYPE_INDEED,
self::BLACKLISTING_TYPE_KIMETA,
self::BLACKLISTING_TYPE_STELLENONLINE,
self::BLACKLISTING_TYPE_AGENTUR_FUER_ARBEIT,
self::BLACKLISTING_TYPE_ONETIME_LOGIN,
self::BLACKLISTING_TYPE_MEINESTADT,
self::BLACKLISTING_TYPE_JOBIJOBA,
self::BLACKLISTING_TYPE_WHATJOBS,
self::BLACKLISTING_TYPE_SEARCH,
self::BLACKLISTING_TYPE_CONVERSATION_MESSAGES,
self::BLACKLISTING_TYPE_JOOBLE,
self::BLACKLISTING_TYPE_STEPSTONE,
self::BLACKLISTING_TYPE_PERSOMATCH,
self::BLACKLISTING_TYPE_XING,
self::BLACKLISTING_TYPE_ALLFEEDS
];
public const BLACKLISTING_TYPES_TO_NAMES = [
self::BLACKLISTING_TYPE_EBAY => 'ebay',
self::BLACKLISTING_TYPE_MAILING => 'mailing',
self::BLACKLISTING_TYPE_REGISTRATION => 'registration',
self::BLACKLISTING_TYPE_RECRUIT => 'recruit',
self::BLACKLISTING_TYPE_MASS_MAILING => 'massmailing',
self::BLACKLISTING_TYPE_JOBRAPIDO => 'jobrapido',
self::BLACKLISTING_TYPE_JOBLIFT => 'joblift',
self::BLACKLISTING_TYPE_TALENTCOM => 'talentcom',
self::BLACKLISTING_TYPE_INDEED => 'indeed',
self::BLACKLISTING_TYPE_KIMETA => 'kimeta',
self::BLACKLISTING_TYPE_STELLENONLINE => 'stellenonline',
self::BLACKLISTING_TYPE_AGENTUR_FUER_ARBEIT => 'agenturfuerarbeit',
self::BLACKLISTING_TYPE_ONETIME_LOGIN => 'onetimelogin',
self::BLACKLISTING_TYPE_MEINESTADT => 'meinestadt',
self::BLACKLISTING_TYPE_JOBIJOBA => 'jobijoba',
self::BLACKLISTING_TYPE_WHATJOBS => 'whatjobs',
self::BLACKLISTING_TYPE_SEARCH => 'suche',
self::BLACKLISTING_TYPE_CONVERSATION_MESSAGES => 'nachrichten',
self::BLACKLISTING_TYPE_JOOBLE => 'jooble',
self::BLACKLISTING_TYPE_STEPSTONE => 'stepstone',
self::BLACKLISTING_TYPE_PERSOMATCH => 'persomatch',
self::BLACKLISTING_TYPE_XING => 'xing',
self::BLACKLISTING_TYPE_ALLFEEDS => 'allfeeds'
];
public function __construct(string $email, int $type)
{
$this->email = $email;
$this->type = $type;
}
/**
* @var string
*
* @ORM\GeneratedValue(strategy="CUSTOM")
*
* @ORM\CustomIdGenerator(class="App\Utility\DatabaseIdGenerator")
*
* @ORM\Column(name="id", type="guid")
*
* @ORM\Id
*/
protected $id;
public function setId(string $id): void
{
GuidUtility::validOrThrow($id);
$this->id = $id;
}
public function getId(): string
{
return $this->id;
}
/**
* @ORM\Column(name="email", type="string", length=1024, nullable=false)
*/
protected string $email;
public function setEmail(string $email)
{
$this->email = $email;
}
public function getEmail(): string
{
return $this->email;
}
/**
* @ORM\Column(name="type", type="integer", nullable=false)
*/
protected int $type;
/**
* @throws Exception
*/
public function setType(int $type)
{
if (!in_array($type, self::BLACKLISTING_TYPES)) {
throw new Exception('Value ' . $type . ' not allowed for type.');
}
$this->type = $type;
}
public function getType(): int
{
return $this->type;
}
}