Add notification method on order entity

This commit is contained in:
Thibaud Fabre
2016-04-27 18:06:16 +02:00
parent eac63db412
commit 1b1debd09c

View File

@@ -20,12 +20,17 @@ use Gedmo\Mapping\Annotation as Gedmo;
*/
class Order
{
const NOTIFY_MAIL = 'mail';
const NOTIFY_WEBHOOK = 'webhook';
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
private $id;
/**
* @ORM\ManyToOne(targetEntity="User")
@@ -67,6 +72,11 @@ class Order
*/
private $basket;
/**
* @ORM\Column(type="string", length=32, name="notification_method")
*/
private $notificationMethod = 'email';
/**
* Constructor
*/
@@ -280,4 +290,26 @@ class Order
{
return $this->basket;
}
/**
* @return string The name of the notification method that will be used to handle this order's status change
* notifications.
*/
public function getNotificationMethod()
{
return $this->notificationMethod;
}
/**
* @param string $methodName Sets the name of the notification method to handle this order's status change
* notifications.
*/
public function setNotificationMethod($methodName)
{
if (trim($methodName) == '') {
$methodName = self::NOTIFY_MAIL;
}
$this->notificationMethod = $methodName;
}
}