forked from dotmailer/dotmailer-magento2-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Review.php
executable file
·57 lines (48 loc) · 1.43 KB
/
Review.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace Dotdigitalgroup\Email\Model;
class Review extends \Magento\Framework\Model\AbstractModel
{
const EMAIL_REVIEW_IMPORTED = 1;
protected $_dateTime;
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Stdlib\DateTime $dateTime,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->_dateTime = $dateTime;
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
/**
* constructor
*/
public function _construct()
{
parent::_construct();
$this->_init('Dotdigitalgroup\Email\Model\Resource\Review');
}
/**
* Prepare data to be saved to database
*
* @return $this
*/
public function beforeSave()
{
parent::beforeSave();
if ($this->isObjectNew()) {
$this->setCreatedAt($this->_dateTime->formatDate(true));
}
$this->setUpdatedAt($this->_dateTime->formatDate(true));
return $this;
}
}