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) $rev->setRating($rating)
->setMessage($msg) ->setMessage($msg)
->setPartner($partner) ->setPartner($partner)
->setMobileSession($this->session); // TODO: add support new customer user entity ->setCustomerSession($this->session); // NOTE: using new customer session entity
// save to db // save to db
$this->em->persist($rev); $this->em->persist($rev);

View file

@ -48,10 +48,24 @@ class Review
// mobile session that sent review // mobile session that sent review
/** /**
* @ORM\ManyToOne(targetEntity="MobileSession", inversedBy="reviews") * @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; 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() public function __construct()
{ {
$this->date_create = new DateTime(); $this->date_create = new DateTime();
@ -114,4 +128,14 @@ class Review
return $this->mobile_session; return $this->mobile_session;
} }
public function setCustomerSession(CustomerSession $customer_session)
{
$this->customer_session = $customer_session;
return $this;
}
public function getCustomerSession()
{
return $this->customer_session;
}
} }