- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use App\Entity\TicketMessage;
- use App\Entity\User;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\ShopBundle\Context\FilterMerchantInterface;
- use Lc\ShopBundle\Context\MerchantInterface;
- use Lc\ShopBundle\Context\OrderShopInterface;
- use Gedmo\Mapping\Annotation as Gedmo;
- use Lc\ShopBundle\Context\UserInterface;
-
-
- abstract class Ticket extends AbstractEntity implements FilterMerchantInterface
- {
- const TYPE_PRODUCT_UNAVAILABLE = 'product-unavailable' ;
- const TYPE_PRODUCT_ERROR = 'product-error' ;
- const TYPE_TECHNICAL_PROBLEM = 'technical-problem' ;
- const TYPE_GENERAL_QUESTION = 'general-question' ;
-
- const TICKET_STATUS_OPEN = 'open' ;
- const TICKET_STATUS_BEING_PROCESSED = 'being-processed' ;
- const TICKET_STATUS_CLOSED = 'closed' ;
-
- use StatusTrait;
-
-
-
- protected $createdBy;
-
-
-
- protected $updatedBy;
-
-
-
- protected $merchant;
-
-
-
- protected $type;
-
-
-
- protected $ticketStatus;
-
-
-
- protected $orderShop;
-
-
-
- protected $subject;
-
-
-
- protected $tags = [];
-
-
-
- protected $visitorFirstname;
-
-
-
- protected $visitorLastname;
-
-
-
- protected $visitorEmail;
-
-
-
- protected $visitorToken;
-
-
-
- protected $ticketMessages;
-
-
-
- protected $user;
-
- public function __construct()
- {
- $this->ticketMessages = new ArrayCollection();
- }
-
- public function getUsername(){
- if($this->getUser()){
- return $this->getUser()->getName();
- }else{
- return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname();
- }
- }
-
- public function getVisitorInfos(){
-
- return strtoupper($this->getVisitorLastname()).' '.$this->getVisitorFirstname(). ' ('.$this->getVisitorEmail().')';
-
- }
-
- public function getMerchant(): ?MerchantInterface
- {
- return $this->merchant;
- }
-
- public function setMerchant(?MerchantInterface $merchant): self
- {
- $this->merchant = $merchant;
-
- return $this;
- }
-
- public function getType(): ?string
- {
- return $this->type;
- }
-
- public function setType(string $type): self
- {
- $this->type = $type;
-
- return $this;
- }
-
- public function getTypeLabel(): string
- {
- return 'field.Ticket.typeOptions.'.$this->getType() ;
- }
-
- public function getTicketStatus(): ?string
- {
- return $this->ticketStatus;
- }
-
- public function setTicketStatus(string $ticketStatus): self
- {
- $this->ticketStatus = $ticketStatus;
-
- return $this;
- }
-
- public function getTicketStatusLabel(): string
- {
- return 'field.Ticket.ticketStatusOptions.'.$this->getTicketStatus() ;
- }
-
- public function getOrderShop(): ?OrderShopInterface
- {
- return $this->orderShop;
- }
-
- public function setOrderShop(?OrderShopInterface $orderShop): self
- {
- $this->orderShop = $orderShop;
-
- return $this;
- }
-
- public function getSubject(): ?string
- {
- return $this->subject;
- }
-
- public function setSubject(string $subject): self
- {
- $this->subject = $subject;
-
- return $this;
- }
-
- public function getTags(): ?array
- {
- return $this->tags;
- }
-
- public function setTags(?array $tags): self
- {
- $this->tags = $tags;
-
- return $this;
- }
-
- public function getVisitorFirstname(): ?string
- {
- return $this->visitorFirstname;
- }
-
- public function setVisitorFirstname(?string $visitorFirstname): self
- {
- $this->visitorFirstname = $visitorFirstname;
-
- return $this;
- }
-
- public function getVisitorLastname(): ?string
- {
- return $this->visitorLastname;
- }
-
- public function setVisitorLastname(?string $visitorLastname): self
- {
- $this->visitorLastname = $visitorLastname;
-
- return $this;
- }
-
- public function getVisitorEmail(): ?string
- {
- return $this->visitorEmail;
- }
-
- public function setVisitorEmail(?string $visitorEmail): self
- {
- $this->visitorEmail = $visitorEmail;
-
- return $this;
- }
-
- public function getVisitorToken(): ?string
- {
- return $this->visitorToken;
- }
-
- public function setVisitorToken(?string $visitorToken): self
- {
- $this->visitorToken = $visitorToken;
-
- return $this;
- }
-
-
-
- public function getTicketMessages(): Collection
- {
- return $this->ticketMessages;
- }
-
- public function addTicketMessage(TicketMessage $ticketMessage): self
- {
- if (!$this->ticketMessages->contains($ticketMessage)) {
- $this->ticketMessages[] = $ticketMessage;
- $ticketMessage->setTicket($this);
- }
-
- return $this;
- }
-
- public function removeTicketMessage(TicketMessage $ticketMessage): self
- {
- if ($this->ticketMessages->contains($ticketMessage)) {
- $this->ticketMessages->removeElement($ticketMessage);
-
- if ($ticketMessage->getTicket() === $this) {
- $ticketMessage->setTicket(null);
- }
- }
-
- return $this;
- }
-
- public function getUser(): ?UserInterface
- {
- return $this->user;
- }
-
- public function setUser(?UserInterface $user): self
- {
- $this->user = $user;
-
- return $this;
- }
- }
|