| Current Path : /var/www/clients/client3/web2/web/vendor/dotmailer/dotmailer-magento2-extension/Model/ |
| Current File : /var/www/clients/client3/web2/web/vendor/dotmailer/dotmailer-magento2-extension/Model/Wishlist.php |
<?php
namespace Dotdigitalgroup\Email\Model;
class Wishlist extends \Magento\Framework\Model\AbstractModel
{
/**
* @var \Magento\Framework\Stdlib\DateTime
*/
private $dateTime;
/**
* Wishlist constructor.
*
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $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.
*
* @return null
*/
public function _construct()
{
parent::_construct();
$this->_init(\Dotdigitalgroup\Email\Model\ResourceModel\Wishlist::class);
}
/**
* Prepare data to be saved to database.
*
* @return $this
*/
public function beforeSave()
{
parent::beforeSave();
if ($this->isObjectNew() && !$this->getCreatedAt()) {
$this->setCreatedAt($this->dateTime->formatDate(true));
}
$this->setUpdatedAt($this->dateTime->formatDate(true));
return $this;
}
}