openDate = new \DateTime(); $this->messages = new ArrayCollection(); $this->ticketLogs = new ArrayCollection(); $this->publicKey = $this->generateToken(64); $this->deleted = false; $this->status = 0; $this->resolve = false; $this->priority = 0; $this->closed = false; } public function setDefault(FormForgeReasonResponseInterface $reasonResponse){ $this->subject = $reasonResponse->getReason()->getName()->getStrValues()[$reasonResponse->getLocale()]; $this->reasonResponse = $reasonResponse; $this->locale = $reasonResponse->getLocale(); $this->customer = $reasonResponse->getUser(); } private function generateToken($length = 64){ $hash = ""; while(strlen($hash) < $length){ try { $hash .= hash('sha512', random_bytes($length)); } catch (\Exception $e) { $hash .= hash('sha512', mt_rand(0,$length*10000)); } } return substr($hash, 0,$length); } /** * use to change the pk if its not unique */ public function regeneratePublicKey(){ $this->publicKey = $this->generateToken(); } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * @param CustomUserInterface $customer * @return TicketItemBase */ public function setCustomer(CustomUserInterface $customer): TicketItemBase { $this->customer = $customer; return $this; } /** * @return CustomUserInterface */ public function getCustomer(): CustomUserInterface { return $this->customer; } /** * @param FormForgeReasonResponseInterface $reasonResponse * @return TicketItemBase */ public function setReasonResponse(FormForgeReasonResponseInterface $reasonResponse): TicketItemBase { $this->reasonResponse = $reasonResponse; return $this; } /** * @return FormForgeReasonResponseInterface |null */ public function getReasonResponse(): ?FormForgeReasonResponseInterface { return $this->reasonResponse; } /** * @param TicketMessageInterface $message * @return TicketItemBase */ public function addMessage(TicketMessageInterface $message): TicketItemBase { if(!$this->messages->contains($message)) $this->messages->add($message); return $this; } /** * @param TicketMessageInterface $message * @return TicketItemBase */ public function removeMessage(TicketMessageInterface $message): TicketItemBase { if($this->messages->contains($message)) $this->messages->removeElement($message); return $this; } /** * @return Collection */ public function getMessages() { return $this->messages; } /** * @param string $locale * @return TicketItemBase */ public function setLocale(string $locale): TicketItemBase { $this->locale = $locale; return $this; } /** * @return string */ public function getLocale(): string { return $this->locale; } /** * @param FolderItem $rootFolder * @return TicketItemBase */ public function setRootFolder(FolderItem $rootFolder): TicketItemBase { $this->rootFolder = $rootFolder; return $this; } /** * @return FolderItem */ public function getRootFolder(): FolderItem { return $this->rootFolder; } /** * @param CustomCompanyServiceInterface $CompanyServiceIntervene * @return TicketItemBase */ public function setCompanyServiceIntervene(CustomCompanyServiceInterface $CompanyServiceIntervene): TicketItemBase { $this->CompanyServiceIntervene = $CompanyServiceIntervene; return $this; } /** * @return CustomCompanyServiceInterface */ public function getCompanyServiceIntervene(): CustomCompanyServiceInterface { return $this->CompanyServiceIntervene; } /** * @param CustomUserInterface $interveningUser * @return TicketItemBase */ public function setInterveningUser(CustomUserInterface $interveningUser): TicketItemBase { $this->interveningUser = $interveningUser; return $this; } /** * @return CustomUserInterface|null */ public function getInterveningUser(): ?CustomUserInterface { return $this->interveningUser; } /** * @param TicketLogInterveningInterface $logItem * @return TicketItemBase */ public function addTicketLog(TicketLogInterveningInterface $logItem): TicketItemBase { if(!$this->ticketLogs->contains($logItem)) $this->ticketLogs->add($logItem); return $this; } /** * @param TicketLogInterveningInterface $logItem * @return TicketItemBase */ public function removeTicketLog(TicketLogInterveningInterface $logItem): TicketItemBase { if($this->ticketLogs->contains($logItem)) $this->ticketLogs->removeElement($logItem); return $this; } /** * @return Collection of TicketItemLog */ public function getTicketLogs(): Collection { return $this->ticketLogs; } /** * Set subject * * @param string $subject * * @return TicketItemBase */ public function setSubject(string $subject) { $this->subject = $subject; return $this; } /** * Get subject * * @return string */ public function getSubject() { return $this->subject; } /** * @return string */ public function getPublicKey(): string { return $this->publicKey; } /** * Set status * * @param integer $status * * @return TicketItemBase */ public function setStatus($status) { $this->status = $status; return $this; } /** * Get status * * @return int */ public function getStatus() { return $this->status; } /** * @param bool $resolve * @return TicketItemBase */ public function setResolve(bool $resolve): TicketItemBase { $this->resolve = $resolve; return $this; } /** * @return bool */ public function isResolve(): bool { return $this->resolve; } /** * Set closeDate * * @param $resolvedDate * @return TicketItemBase */ public function setResolvedDate($resolvedDate) { $this->resolvedDate = $resolvedDate; return $this; } /** * Get resolvedDate * * @return \DateTime */ public function getResolvedDate() { return $this->resolvedDate; } public function setOpenDate(\DateTimeInterface $openDate): self { $this->openDate = $openDate; return $this; } /** * Get openDate * * @return \DateTime */ public function getOpenDate() { return $this->openDate; } /** * @param bool $closed * @return TicketItemBase */ public function setClosed(bool $closed): TicketItemBase { $this->closed = $closed; return $this; } /** * @return bool */ public function isClosed(): bool { return $this->closed; } /** * Set closeDate * * @param \DateTime $closeDate * * @return TicketItemBase */ public function setCloseDate($closeDate) { $this->closeDate = $closeDate; return $this; } /** * Get closeDate * * @return \DateTime */ public function getCloseDate() { return $this->closeDate; } /** * Set priority * * @param integer $priority * * @return TicketItemBase */ public function setPriority($priority) { $this->priority = $priority; return $this; } /** * Get priority * * @return int */ public function getPriority() { return $this->priority; } /** * @param bool $deleted * @return TicketItemBase */ public function setDeleted(bool $deleted): TicketItemBase { $this->deleted = $deleted; return $this; } /** * @return bool */ public function isDeleted(): bool { return $this->deleted; } /** * @param UserGroup $group * @return TicketItemBase */ public function setGroup(UserGroup $group): TicketItemBase { $this->group = $group; return $this; } /** * @return UserGroup */ public function getGroup(): UserGroup { return $this->group; } }