Add entities for the customer tag and promo log. #558
This commit is contained in:
parent
5d5ccb6645
commit
59f29b223d
3 changed files with 291 additions and 0 deletions
|
|
@ -208,12 +208,20 @@ class Customer
|
|||
*/
|
||||
protected $create_source;
|
||||
|
||||
// customer tags
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="CustomerTag", inversedBy="customers")
|
||||
* @ORM\JoinTable(name="customer_customer_tags")
|
||||
*/
|
||||
protected $customer_tags;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->numbers = new ArrayCollection();
|
||||
$this->sessions = new ArrayCollection();
|
||||
$this->vehicles = new ArrayCollection();
|
||||
$this->job_orders = new ArrayCollection();
|
||||
$this->customer_tags = new ArrayCollection();
|
||||
|
||||
$this->customer_classification = CustomerClassification::REGULAR;
|
||||
$this->customer_notes = '';
|
||||
|
|
@ -608,4 +616,26 @@ class Customer
|
|||
{
|
||||
return $this->create_source;
|
||||
}
|
||||
|
||||
public function addCustomerTag(CustomerTag $customer_tag)
|
||||
{
|
||||
$this->customer_tags->add($customer_tag);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearCustomerTags()
|
||||
{
|
||||
$this->customer_tags->clear();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomerTags()
|
||||
{
|
||||
$str_customer_tags = [];
|
||||
foreach ($this->customer_tags as $customer_tag)
|
||||
$str_customer_tags[] = $customer_tag->getID();
|
||||
|
||||
return $str_customer_tags;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
93
src/Entity/CustomerTag.php
Normal file
93
src/Entity/CustomerTag.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use DateTime;
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="customer_tag")
|
||||
*/
|
||||
class CustomerTag
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name of tag
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// flag for car club member
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $flag_car_club_member;
|
||||
|
||||
// flag for car club promo
|
||||
/**
|
||||
* @ORM\Column(type="boolean")
|
||||
*/
|
||||
protected $flag_car_club_promo;
|
||||
|
||||
// customers
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Customer", mappedBy="customer_tags", fetch="EXTRA_LAZY")
|
||||
*/
|
||||
protected $customers;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
$this->customers = new ArrayCollection();
|
||||
$this->car_club_member = false;
|
||||
$this->car_club_promo = false;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function getDateCreate()
|
||||
{
|
||||
return $this->date_create;
|
||||
}
|
||||
|
||||
public function addCustomer(Customer $customer)
|
||||
{
|
||||
$this->customers[$customer->getID()] = $customer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearCustomers()
|
||||
{
|
||||
$this->customers->clear();
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomers()
|
||||
{
|
||||
return $this->customers;
|
||||
}
|
||||
}
|
||||
168
src/Entity/PromoLog.php
Normal file
168
src/Entity/PromoLog.php
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="promo_log")
|
||||
*/
|
||||
class PromoLog
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// date created
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
protected $date_create;
|
||||
|
||||
// user that created the JO
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
*/
|
||||
protected $created_by;
|
||||
|
||||
// customer id
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $cust_id;
|
||||
|
||||
// customer first name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
*/
|
||||
protected $cust_first_name;
|
||||
|
||||
// customer last name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
*/
|
||||
protected $cust_last_name;
|
||||
|
||||
// job order id
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $jo_id;
|
||||
|
||||
// invoice id
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $invoice_id;
|
||||
|
||||
// total amount
|
||||
/**
|
||||
* @ORM\Column(type="decimal", precision=9, scale=2)
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setDateCreate(DateTime $date_create)
|
||||
{
|
||||
$this->date_create = $date_create;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateCreate()
|
||||
{
|
||||
return $this->date_create;
|
||||
}
|
||||
|
||||
public function setCreatedBy($created_by)
|
||||
{
|
||||
$this->created_by = $created_by;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->created_by;
|
||||
}
|
||||
|
||||
public function setCustId($cust_id)
|
||||
{
|
||||
$this->cust_id = $cust_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustId()
|
||||
{
|
||||
return $this->cust_id;
|
||||
}
|
||||
|
||||
public function setCustFirstName($cust_first_name)
|
||||
{
|
||||
$this->cust_first_name = $cust_first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustFirstName()
|
||||
{
|
||||
return $this->cust_first_name;
|
||||
}
|
||||
|
||||
public function setCustLastName($cust_last_name)
|
||||
{
|
||||
$this->cust_last_name = $cust_last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustLastName()
|
||||
{
|
||||
return $this->cust_last_name;
|
||||
}
|
||||
|
||||
public function setJoId($jo_id)
|
||||
{
|
||||
$this->jo_id = $jo_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getJoId()
|
||||
{
|
||||
return $this->jo_id;
|
||||
}
|
||||
|
||||
public function setInvoiceId($invoice_id)
|
||||
{
|
||||
$this->invoice_id = $invoice_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getInvoiceId()
|
||||
{
|
||||
return $this->invoice_id;
|
||||
}
|
||||
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue