src/Entity/Product/GuestProduct.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Product;
  3. use App\Entity\CustomerGroup;
  4. use App\Entity\User;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * Class GuestProduct
  9.  *
  10.  * @ORM\Table(name="malys_guest_product")
  11.  * @ORM\Entity(repositoryClass="App\Repository\GuestProductRepository")
  12.  * @package App\Entity
  13.  */
  14. class GuestProduct extends Product
  15. {
  16.     public function __toString()
  17.     {
  18.         // TODO: Implement __toString() method.
  19.         return $this->getId() . ' : ' $this->getCode() . ' : ';
  20.     }
  21.     public const ORDER_UNITS_CHOICES = [
  22.         'kilo',
  23.         'bouteille',
  24.         'unitĂ©',
  25.         'boite',
  26.         'colis'
  27.     ];
  28.     public const CUSTOM_ORDER_UNIT_LABEL 'autre';
  29.     /**
  30.      * @var CustomerGroup
  31.      *
  32.      * @ORM\ManyToOne(targetEntity="App\Entity\CustomerGroup", inversedBy="guestProducts")
  33.      * @ORM\JoinColumn(name="by_customer_group_id", referencedColumnName="id", onDelete="CASCADE")
  34.      * @Assert\NotBlank()
  35.      */
  36.     protected $byCustomerGroup;
  37.     /**
  38.      * @var User
  39.      *
  40.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="guestProducts")
  41.      * @ORM\JoinColumn(name="author", referencedColumnName="id")
  42.      * @Assert\NotBlank()
  43.      */
  44.     protected $author;
  45.     /**
  46.      * @var User
  47.      *
  48.      * @ORM\ManyToOne(targetEntity="App\Entity\User")
  49.      * @ORM\JoinColumn(name="impersonator", referencedColumnName="id")
  50.      */
  51.     protected $impersonator;
  52.     /**
  53.      * @var string
  54.      * @ORM\Column(name="orderUnit", type="string", length=255, nullable=false)
  55.      * @Assert\NotBlank(message="Indiquez le conditionnement du produit", groups={"customerEdit", "Default", "invoiceEdit"})
  56.      */
  57.     protected $orderUnit;
  58.     /**
  59.      * @Assert\NotBlank(message="Indiquez le nom du produit", groups={"customerEdit", "Default", "invoiceEdit"})
  60.      */
  61.     protected $name;
  62.     /**
  63.      * @ORM\ManyToMany(targetEntity="App\Entity\Invoice", mappedBy="products")
  64.      * @ORM\JoinTable(name="malys_invoices_products")
  65.      */
  66.     protected $invoices;
  67.     /**
  68.      * @ORM\Column(name="price", type="float", nullable=true)
  69.      * @Assert\NotBlank(message="Indiquez le prix du produit", groups={"invoiceEdit"})
  70.      * @Assert\Type(type="numeric", message="Cette valeur doit ĂȘtre un nombre", groups={"invoiceEdit", "customerEdit"})
  71.      */
  72.     protected $price;
  73.     /**
  74.      * Gets the author.
  75.      *
  76.      * @return User
  77.      */
  78.     public function getAuthor()
  79.     {
  80.         return $this->author;
  81.     }
  82.     /**
  83.      * Sets the author.
  84.      *
  85.      * @param User $author
  86.      * @return GuestProduct
  87.      */
  88.     public function setAuthor(User $author)
  89.     {
  90.         $this->author $author;
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return CustomerGroup
  95.      */
  96.     public function getByCustomerGroup()
  97.     {
  98.         return $this->byCustomerGroup;
  99.     }
  100.     /**
  101.      * @param CustomerGroup $byCustomerGroup
  102.      */
  103.     public function setByCustomerGroup($byCustomerGroup)
  104.     {
  105.         $this->byCustomerGroup $byCustomerGroup;
  106.     }
  107.     public function getType()
  108.     {
  109.         return parent::TYPE_GUEST;
  110.     }
  111.     /**
  112.      * @return string
  113.      */
  114.     public function getOrderUnit(): ?string
  115.     {
  116.         return $this->orderUnit;
  117.     }
  118.     /**
  119.      * @param string $orderUnit
  120.      */
  121.     public function setOrderUnit(?string $orderUnit): void
  122.     {
  123.         $this->orderUnit $orderUnit;
  124.     }
  125.     /**
  126.      * @return User
  127.      */
  128.     public function getImpersonator(): ?User
  129.     {
  130.         return $this->impersonator;
  131.     }
  132.     /**
  133.      * @param User $impersonator
  134.      */
  135.     public function setImpersonator(User $impersonator): void
  136.     {
  137.         $this->impersonator $impersonator;
  138.     }
  139.     /**
  140.      * @return mixed
  141.      */
  142.     public function getPrice()
  143.     {
  144.         return $this->price;
  145.     }
  146.     /**
  147.      * @param mixed $price
  148.      */
  149.     public function setPrice($price): void
  150.     {
  151.         $this->price $price;
  152.     }
  153.     /**
  154.      * @return mixed
  155.      */
  156.     public function getInvoices()
  157.     {
  158.         return $this->invoices;
  159.     }
  160.     /**
  161.      * @param mixed $invoices
  162.      */
  163.     public function setInvoices($invoices): void
  164.     {
  165.         $this->invoices $invoices;
  166.     }
  167.     /**
  168.     public function addInvoice( Invoice $invoice ) {
  169.         if ( ! $this->invoices->contains( $invoice) ) {
  170.             $this->invoices->add( $invoice );
  171.         }
  172.     }
  173.     public function removeI
  174.      * */
  175. }