src/JanusHercules/IndeedCampaignManagement/Domain/Entity/CampaignContentSnapshot.php line 18

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace JanusHercules\IndeedCampaignManagement\Domain\Entity;
  4. use App\Entity\RecurrentJob;
  5. use App\Utility\DatabaseIdGenerator;
  6. use App\Utility\DateTimeUtility;
  7. use DateTime;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Exception;
  11. use JanusHercules\IndeedCampaignManagement\Domain\Dto\RecurrentJobInfoDto;
  12. #[ORM\Entity]
  13. #[ORM\Table(name: 'icm_campaign_content_snapshots')]
  14. class CampaignContentSnapshot
  15. {
  16. /**
  17. * @throws Exception
  18. */
  19. public function __construct(
  20. RecurrentJobInfoDto $recurrentJobInfo,
  21. bool $recurrentJobNoLongerExists = false,
  22. bool $recurrentJobNoLongerProvided = false
  23. ) {
  24. $this->createdAt = DateTimeUtility::createDateTimeUtc();
  25. $this->recurrentJobCreatedAt = $recurrentJobInfo->createdAt;
  26. $this->recurrentJobId = $recurrentJobInfo->recurrentJobId;
  27. $this->recurrentJobUserId = $recurrentJobInfo->userId;
  28. $this->recurrentJobUserEmail = $recurrentJobInfo->userEmail;
  29. $this->recurrentJobStatus = $recurrentJobInfo->status;
  30. $this->recurrentJobJoboffererProfileBusinessName = $recurrentJobInfo->joboffererProfileBusinessName;
  31. $this->recurrentJobCustomerInternalId = $recurrentJobInfo->customerInternalId;
  32. $this->title = $recurrentJobInfo->title;
  33. $this->description = $recurrentJobInfo->description;
  34. $this->additionalDescription = $recurrentJobInfo->additionalDescription;
  35. $this->selfdescription = $recurrentJobInfo->selfdescription;
  36. $this->employmentTypes = json_encode($recurrentJobInfo->employmentTypes) ?: null;
  37. $this->requiredExperience = $recurrentJobInfo->requiredExperience;
  38. $this->address = $recurrentJobInfo->address;
  39. $this->city = $recurrentJobInfo->city;
  40. $this->zipcode = $recurrentJobInfo->zipcode;
  41. $this->bundesland = $recurrentJobInfo->bundesland;
  42. $this->occupationalFieldSearchterm = $recurrentJobInfo->occupationalFieldSearchterm;
  43. $this->hasActiveSelfServiceTrafficCampaign = $recurrentJobInfo->hasActiveSelfServiceTrafficCampaign;
  44. $this->userHasActiveHigherPricedFlexMembership = $recurrentJobInfo->userHasActiveHigherPricedFlexMembership;
  45. $this->isBlacklistedForIndeed = $recurrentJobInfo->isBlacklistedForIndeed;
  46. $this->isProfilePaused = $recurrentJobInfo->isProfilePaused;
  47. $this->isCustomerReleasedForIndeed = $recurrentJobInfo->isCustomerReleasedForIndeed;
  48. $this->inFeedIndeedStatus = $recurrentJobInfo->inFeedIndeedStatus;
  49. $this->xmlFeedCategory = $recurrentJobInfo->xmlFeedCategory;
  50. $this->recurrentJobNoLongerExists = $recurrentJobNoLongerExists;
  51. $this->recurrentJobNoLongerProvided = $recurrentJobNoLongerProvided;
  52. }
  53. #[ORM\Id]
  54. #[ORM\GeneratedValue(strategy: 'CUSTOM')]
  55. #[ORM\CustomIdGenerator(class: DatabaseIdGenerator::class)]
  56. #[ORM\Column(
  57. type : Types::GUID,
  58. unique: true
  59. )]
  60. private ?string $id = null;
  61. public function getId(): ?string
  62. {
  63. return $this->id;
  64. }
  65. #[ORM\Column(
  66. type : Types::DATETIME_MUTABLE,
  67. nullable: false
  68. )]
  69. private DateTime $createdAt;
  70. public function getCreatedAt(): DateTime
  71. {
  72. return $this->createdAt;
  73. }
  74. #[ORM\Column(
  75. type : Types::DATETIME_MUTABLE,
  76. nullable: false
  77. )]
  78. private DateTime $recurrentJobCreatedAt;
  79. public function getRecurrentJobCreatedAt(): DateTime
  80. {
  81. return $this->recurrentJobCreatedAt;
  82. }
  83. #[ORM\Column(
  84. type : Types::GUID,
  85. nullable: false
  86. )]
  87. private string $recurrentJobId;
  88. public function getRecurrentJobId(): string
  89. {
  90. return $this->recurrentJobId;
  91. }
  92. #[ORM\Column(
  93. type : Types::GUID,
  94. nullable: false
  95. )]
  96. private string $recurrentJobUserId;
  97. public function getRecurrentJobUserId(): string
  98. {
  99. return $this->recurrentJobUserId;
  100. }
  101. #[ORM\Column(
  102. type : Types::STRING,
  103. nullable: false,
  104. )]
  105. private string $recurrentJobUserEmail;
  106. public function getRecurrentJobUserEmail(): string
  107. {
  108. return $this->recurrentJobUserEmail;
  109. }
  110. #[ORM\Column(
  111. type : Types::INTEGER,
  112. nullable: false,
  113. options : ['default' => RecurrentJob::STATUS_ACTIVE]
  114. )]
  115. private int $recurrentJobStatus;
  116. public function getRecurrentJobStatus(): int
  117. {
  118. return $this->recurrentJobStatus;
  119. }
  120. #[ORM\Column(
  121. type : Types::STRING,
  122. nullable: true,
  123. )]
  124. private ?string $recurrentJobJoboffererProfileBusinessName;
  125. public function getRecurrentJobJoboffererProfileBusinessName(): ?string
  126. {
  127. return $this->recurrentJobJoboffererProfileBusinessName;
  128. }
  129. #[ORM\Column(
  130. type : Types::STRING,
  131. nullable: true,
  132. )]
  133. private ?string $recurrentJobCustomerInternalId;
  134. public function getRecurrentJobCustomerInternalId(): ?string
  135. {
  136. return $this->recurrentJobCustomerInternalId;
  137. }
  138. #[ORM\Column(
  139. type : Types::STRING,
  140. nullable: false,
  141. )]
  142. private string $zipcode;
  143. public function getZipcode(): string
  144. {
  145. return $this->zipcode;
  146. }
  147. #[ORM\Column(
  148. type : Types::STRING,
  149. nullable: false,
  150. )]
  151. private string $occupationalFieldSearchterm;
  152. public function getOccupationalFieldSearchterm(): string
  153. {
  154. return $this->occupationalFieldSearchterm;
  155. }
  156. #[ORM\Column(
  157. type : Types::BOOLEAN,
  158. nullable: false,
  159. options : ['default' => false]
  160. )]
  161. private bool $recurrentJobNoLongerExists;
  162. public function getRecurrentJobNoLongerExists(): bool
  163. {
  164. return $this->recurrentJobNoLongerExists;
  165. }
  166. public function setRecurrentJobNoLongerExists(bool $recurrentJobNoLongerExists): void
  167. {
  168. $this->recurrentJobNoLongerExists = $recurrentJobNoLongerExists;
  169. }
  170. #[ORM\Column(
  171. type : Types::BOOLEAN,
  172. nullable: false,
  173. options : ['default' => false]
  174. )]
  175. private bool $recurrentJobNoLongerProvided;
  176. public function getRecurrentJobNoLongerProvided(): bool
  177. {
  178. return $this->recurrentJobNoLongerProvided;
  179. }
  180. public function setRecurrentJobNoLongerProvided(bool $recurrentJobNoLongerProvided): void
  181. {
  182. $this->recurrentJobNoLongerProvided = $recurrentJobNoLongerProvided;
  183. }
  184. #[ORM\Column(name: 'title', type: Types::STRING, nullable: true)]
  185. private ?string $title;
  186. public function getTitle(): ?string
  187. {
  188. return $this->title;
  189. }
  190. #[ORM\Column(name: 'description', type: Types::TEXT, nullable: true)]
  191. private ?string $description;
  192. public function getDescription(): ?string
  193. {
  194. return $this->description;
  195. }
  196. #[ORM\Column(name: 'additional_description', type: Types::TEXT, nullable: true)]
  197. private ?string $additionalDescription;
  198. public function getAdditionalDescription(): ?string
  199. {
  200. return $this->additionalDescription;
  201. }
  202. #[ORM\Column(name: 'selfdescription', type: Types::TEXT, nullable: true)]
  203. private ?string $selfdescription;
  204. public function getSelfdescription(): ?string
  205. {
  206. return $this->selfdescription;
  207. }
  208. #[ORM\Column(name: 'employment_types', type: Types::JSON, nullable: true)]
  209. private ?string $employmentTypes;
  210. /**
  211. * @return string[]|null
  212. */
  213. public function getEmploymentTypes(): ?array
  214. {
  215. if ($this->employmentTypes === null) {
  216. return null;
  217. }
  218. $decoded = json_decode($this->employmentTypes, true);
  219. return is_array($decoded) ? $decoded : null;
  220. }
  221. #[ORM\Column(name: 'required_experience', type: Types::INTEGER, nullable: true)]
  222. private ?int $requiredExperience;
  223. public function getRequiredExperience(): ?int
  224. {
  225. return $this->requiredExperience;
  226. }
  227. #[ORM\Column(name: 'address', type: Types::STRING, nullable: true)]
  228. private ?string $address;
  229. public function getAddress(): ?string
  230. {
  231. return $this->address;
  232. }
  233. #[ORM\Column(name: 'city', type: Types::STRING, nullable: true)]
  234. private ?string $city;
  235. public function getCity(): ?string
  236. {
  237. return $this->city;
  238. }
  239. #[ORM\Column(name: 'bundesland', type: Types::STRING, nullable: true)]
  240. private ?string $bundesland;
  241. public function getBundesland(): ?string
  242. {
  243. return $this->bundesland;
  244. }
  245. #[ORM\Column(
  246. type : Types::BOOLEAN,
  247. nullable: false,
  248. options : ['default' => false]
  249. )]
  250. private bool $hasActiveSelfServiceTrafficCampaign;
  251. public function hasActiveSelfServiceTrafficCampaign(): bool
  252. {
  253. return $this->hasActiveSelfServiceTrafficCampaign;
  254. }
  255. #[ORM\Column(
  256. name : 'user_has_active_higher_priced_flex_membership',
  257. type : Types::BOOLEAN,
  258. nullable: false,
  259. options : ['default' => false]
  260. )]
  261. private bool $userHasActiveHigherPricedFlexMembership;
  262. public function userHasActiveHigherPricedFlexMembership(): bool
  263. {
  264. return $this->userHasActiveHigherPricedFlexMembership;
  265. }
  266. #[ORM\Column(
  267. type : Types::BOOLEAN,
  268. nullable: false,
  269. options : ['default' => false]
  270. )]
  271. private bool $isBlacklistedForIndeed;
  272. public function isBlacklistedForIndeed(): bool
  273. {
  274. return $this->isBlacklistedForIndeed;
  275. }
  276. #[ORM\Column(
  277. type : Types::BOOLEAN,
  278. nullable: false,
  279. options : ['default' => false]
  280. )]
  281. private bool $isProfilePaused;
  282. public function isProfilePaused(): bool
  283. {
  284. return $this->isProfilePaused;
  285. }
  286. #[ORM\Column(
  287. type : Types::BOOLEAN,
  288. nullable: true
  289. )]
  290. private ?bool $isCustomerReleasedForIndeed;
  291. public function isCustomerReleasedForIndeed(): ?bool
  292. {
  293. return $this->isCustomerReleasedForIndeed;
  294. }
  295. #[ORM\Column(
  296. type : Types::STRING,
  297. nullable: true
  298. )]
  299. private ?string $inFeedIndeedStatus;
  300. public function getInFeedIndeedStatus(): ?string
  301. {
  302. return $this->inFeedIndeedStatus;
  303. }
  304. #[ORM\Column(
  305. type : Types::STRING,
  306. nullable: true
  307. )]
  308. private ?string $xmlFeedCategory;
  309. public function getXmlFeedCategory(): ?string
  310. {
  311. return $this->xmlFeedCategory;
  312. }
  313. }