<?php
/**
* Created by PhpStorm.
* User: Toni Peral <toniperal.a4b@gmail.com>
* Date: 24/11/20
* Time: 13:12
*/
namespace App\Entity\System;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="ps_service_customer")
*
* @ORM\Entity(repositoryClass="App\Repository\System\ServiceCustomerRepository")
*/
class ServiceCustomer
{
/**
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @ORM\Column(name="id_service_customer", type="integer")
*/
private $id;
/**
* @var Service
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Service", inversedBy="serviceCustomer")
*
* @ORM\JoinColumn(name="id_service", referencedColumnName="id_service")
*/
private $service;
/**
* @var Customer
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\Customer", inversedBy="serviceCustomer")
*
* @ORM\JoinColumn(name="id_customer", referencedColumnName="id_customer")
*/
private $customer;
/**
* @var int|null
*
* @ORM\Column(name="id_order", type="integer", length=11, nullable=true)
*/
private $orderId;
/**
* @var int|null
*
* @ORM\Column(name="id_product", type="integer", length=11, nullable=true)
*/
private $productId;
/**
* @var bool|null
*
* @ORM\Column(type="boolean", columnDefinition="tinyint(4)", nullable=true)
*/
private $active;
/**
* @var \DateTime|null
*
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateAdd;
/**
* @var OrderDetail|null
*
* @ORM\ManyToOne(targetEntity="App\Entity\System\OrderDetail", inversedBy="serviceCustomer")
*
* @ORM\JoinColumn(name="id_order_detail", referencedColumnName="id_order_detail")
*/
private ?OrderDetail $orderDetail;
/**
* @var ServiceCustomerParameter
*
* @ORM\OneToMany(targetEntity="App\Entity\System\ServiceCustomerParameter", mappedBy="serviceCustomer", cascade={"persist"})
*/
private $serviceCustomerParameter;
public function __construct()
{
$this->serviceCustomerParameter = new ArrayCollection();
$this->dateAdd = new \DateTime();
}
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*
* @return ServiceCustomer
*/
public function setId($id): ServiceCustomer
{
$this->id = $id;
return $this;
}
/**
* @return Service
*/
public function getService(): Service
{
return $this->service;
}
/**
* @param Service $service
*
* @return ServiceCustomer
*/
public function setService(Service $service): ServiceCustomer
{
$this->service = $service;
return $this;
}
/**
* @return Customer
*/
public function getCustomer(): Customer
{
return $this->customer;
}
/**
* @param Customer $customer
*
* @return ServiceCustomer
*/
public function setCustomer(Customer $customer): ServiceCustomer
{
$this->customer = $customer;
return $this;
}
/**
* @return int|null
*/
public function getOrderId(): ?int
{
return $this->orderId;
}
/**
* @param int|null $orderId
*
* @return ServiceCustomer
*/
public function setOrderId(?int $orderId): ServiceCustomer
{
$this->orderId = $orderId;
return $this;
}
/**
* @return int|null
*/
public function getProductId(): ?int
{
return $this->productId;
}
/**
* @param int|null $productId
*
* @return ServiceCustomer
*/
public function setProductId(?int $productId): ServiceCustomer
{
$this->productId = $productId;
return $this;
}
/**
* @return bool|null
*/
public function getActive(): ?bool
{
return $this->active;
}
/**
* @param bool|null $active
*
* @return ServiceCustomer
*/
public function setActive(?bool $active): ServiceCustomer
{
$this->active = $active;
return $this;
}
/**
* @return \DateTime|null
*/
public function getDateAdd(): ?\DateTime
{
return $this->dateAdd;
}
/**
* @param \DateTime|null $dateAdd
*
* @return ServiceCustomer
*/
public function setDateAdd(?\DateTime $dateAdd): ServiceCustomer
{
$this->dateAdd = $dateAdd;
return $this;
}
/**
* @return ServiceCustomerParameter
*/
public function getServiceCustomerParameter()
{
return $this->serviceCustomerParameter;
}
/**
* @param ServiceCustomerParameter $serviceCustomerParameter
*
* @return ServiceCustomer
*/
public function setServiceCustomerParameter(ServiceCustomerParameter $serviceCustomerParameter): ServiceCustomer
{
$this->serviceCustomerParameter = $serviceCustomerParameter;
return $this;
}
public function getOrderDetail(): ?OrderDetail
{
return $this->orderDetail;
}
public function setOrderDetail(?OrderDetail $orderDetail): ServiceCustomer
{
$this->orderDetail = $orderDetail;
return $this;
}
/**
* @param Customer $customer
* @param Service $service
*/
public function initializeCustomerAndService(Customer $customer, Service $service): void
{
$this->customer = $customer;
$this->service = $service;
$this->active = true;
$this->dateAdd = new \DateTime();
}
}