Add support for new customer sessions on partner reviews #730

This commit is contained in:
Ramon Gutierrez 2023-04-28 18:08:23 +08:00
parent 3bf350ceaf
commit 1261fc1d20
2 changed files with 26 additions and 2 deletions

View file

@ -152,7 +152,7 @@ class PartnerController extends ApiController
$rev->setRating($rating)
->setMessage($msg)
->setPartner($partner)
->setMobileSession($this->session); // TODO: add support new customer user entity
->setCustomerSession($this->session); // NOTE: using new customer session entity
// save to db
$this->em->persist($rev);

View file

@ -48,10 +48,24 @@ class Review
// mobile session that sent review
/**
* @ORM\ManyToOne(targetEntity="MobileSession", inversedBy="reviews")
* @ORM\JoinColumn(name="mobile_session_id", referencedColumnName="id")
* @ORM\JoinColumn(name="mobile_session_id", referencedColumnName="id", nullable=true)
*/
protected $mobile_session;
// customer session (new) that sent review
/**
* @ORM\ManyToOne(targetEntity="CustomerSession", inversedBy="reviews")
* @ORM\JoinColumn(name="customer_session_id", referencedColumnName="id", nullable=true)
*/
protected $customer_session;
// customer user sent review
/**
* @ORM\ManyToOne(targetEntity="MobileSession", inversedBy="reviews")
* @ORM\JoinColumn(name="mobile_session_id", referencedColumnName="id")
*/
protected $customer;
public function __construct()
{
$this->date_create = new DateTime();
@ -113,5 +127,15 @@ class Review
{
return $this->mobile_session;
}
public function setCustomerSession(CustomerSession $customer_session)
{
$this->customer_session = $customer_session;
return $this;
}
public function getCustomerSession()
{
return $this->customer_session;
}
}