Переглянути джерело

Modèles tickets

feature/export_comptable
Guillaume 4 роки тому
джерело
коміт
624be0d30b
6 змінених файлів з 402 додано та 0 видалено
  1. +8
    -0
      ShopBundle/Context/TicketInterface.php
  2. +8
    -0
      ShopBundle/Context/TicketMessageInterface.php
  3. +272
    -0
      ShopBundle/Model/Ticket.php
  4. +65
    -0
      ShopBundle/Model/TicketMessage.php
  5. +24
    -0
      ShopBundle/Repository/TicketMessageRepository.php
  6. +25
    -0
      ShopBundle/Repository/TicketRepository.php

+ 8
- 0
ShopBundle/Context/TicketInterface.php Переглянути файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface TicketInterface
{

}

+ 8
- 0
ShopBundle/Context/TicketMessageInterface.php Переглянути файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface TicketMessageInterface
{

}

+ 272
- 0
ShopBundle/Model/Ticket.php Переглянути файл

@@ -0,0 +1,272 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\TicketMessage;
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;

/**
* @ORM\MappedSuperclass()
*/
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 = 'fermé' ;

use StatusTrait;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\Column(type="string", length=32)
*/
protected $type;

/**
* @ORM\Column(type="text", nullable=true)
*/
protected $typeHelp;

/**
* @ORM\Column(type="string", length=32)
*/
protected $ticketStatus;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", inversedBy="tickets")
*/
protected $orderShop;

/**
* @ORM\Column(type="string", length=255)
*/
protected $subject;

/**
* @ORM\Column(type="array", nullable=true)
*/
protected $tags = [];

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $visitorFirstname;

/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
protected $visitorLastname;

/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
protected $visitorEmail;

/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
protected $visitorToken;

/**
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\TicketMessageInterface", mappedBy="ticket", orphanRemoval=true)
*/
protected $ticketMessages;

public function __construct()
{
$this->ticketMessages = new ArrayCollection();
}

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 getTypeHelp(): ?string
{
return $this->typeHelp;
}

public function setTypeHelp(?string $typeHelp): self
{
$this->typeHelp = $typeHelp;

return $this;
}

public function getTicketStatus(): ?string
{
return $this->ticketStatus;
}

public function setTicketStatus(string $ticketStatus): self
{
$this->ticketStatus = $ticketStatus;

return $this;
}

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;
}

/**
* @return Collection|TicketMessage[]
*/
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);
// set the owning side to null (unless already changed)
if ($ticketMessage->getTicket() === $this) {
$ticketMessage->setTicket(null);
}
}

return $this;
}
}

+ 65
- 0
ShopBundle/Model/TicketMessage.php Переглянути файл

@@ -0,0 +1,65 @@
<?php

namespace Lc\ShopBundle\Model;

use App\Entity\Ticket;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\TicketInterface;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\MappedSuperclass()
*/
abstract class TicketMessage
{
use StatusTrait;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

/**
* @ORM\Column(type="text")
*/
protected $message;

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TicketInterface", inversedBy="ticketMessages")
* @ORM\JoinColumn(nullable=false)
*/
protected $ticket;

public function getMessage(): ?string
{
return $this->message;
}

public function setMessage(string $message): self
{
$this->message = $message;

return $this;
}

public function getTicket(): ?TicketInterface
{
return $this->ticket;
}

public function setTicket(?TicketInterface $ticket): self
{
$this->ticket = $ticket;

return $this;
}
}

+ 24
- 0
ShopBundle/Repository/TicketMessageRepository.php Переглянути файл

@@ -0,0 +1,24 @@
<?php

namespace Lc\ShopBundle\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\TicketInterface;
use Lc\ShopBundle\Context\TicketMessageInterface;
use Lc\ShopBundle\Repository\BaseRepository;

/**
* @method TicketMessageInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketMessageInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketMessageInterface[] findAll()
* @method TicketMessageInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketMessageRepository extends BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return TicketMessageInterface::class;
}
}

+ 25
- 0
ShopBundle/Repository/TicketRepository.php Переглянути файл

@@ -0,0 +1,25 @@
<?php

namespace Lc\ShopBundle\Repository;

use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\TicketInterface;
use Lc\ShopBundle\Context\UnitInterface;
use Lc\ShopBundle\Repository\BaseRepository;

/**
* @method TicketInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method TicketInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method TicketInterface[] findAll()
* @method TicketInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class TicketRepository extends BaseRepository implements DefaultRepositoryInterface
{
public function getInterfaceClass()
{
return TicketInterface::class;
}
}


Завантаження…
Відмінити
Зберегти