Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Message.php
Go to the documentation of this file.
1 <?php
7 
9 
19 {
23  protected $_typeFactory;
24 
35  public function __construct(
36  \Magento\Framework\Model\Context $context,
37  \Magento\Framework\Registry $registry,
38  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
40  \Magento\GiftMessage\Model\TypeFactory $typeFactory,
41  \Magento\GiftMessage\Model\ResourceModel\Message $resource = null,
42  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
43  array $data = []
44  ) {
45  $this->_typeFactory = $typeFactory;
46  parent::__construct(
47  $context,
48  $registry,
49  $extensionFactory,
51  $resource,
52  $resourceCollection,
53  $data
54  );
55  }
56 
60  protected function _construct()
61  {
62  $this->_init(\Magento\GiftMessage\Model\ResourceModel\Message::class);
63  }
64 
71  public function getEntityModelByType($type)
72  {
73  return $this->_typeFactory->createType($type);
74  }
75 
81  public function isMessageEmpty()
82  {
83  return trim($this->getMessage()) == '';
84  }
85 
86  //@codeCoverageIgnoreStart
87 
91  public function getGiftMessageId()
92  {
93  return $this->getData(self::GIFT_MESSAGE_ID);
94  }
95 
99  public function setGiftMessageId($id)
100  {
101  return $this->setData(self::GIFT_MESSAGE_ID, $id);
102  }
103 
107  public function getCustomerId()
108  {
109  return $this->getData(self::CUSTOMER_ID);
110  }
111 
115  public function setCustomerId($id)
116  {
117  return $this->setData(self::CUSTOMER_ID, $id);
118  }
119 
123  public function getSender()
124  {
125  return $this->getData(self::SENDER);
126  }
127 
131  public function setSender($sender)
132  {
133  return $this->setData(self::SENDER, $sender);
134  }
135 
139  public function getRecipient()
140  {
141  return $this->getData(self::RECIPIENT);
142  }
143 
147  public function setRecipient($recipient)
148  {
149  return $this->setData(self::RECIPIENT, $recipient);
150  }
151 
155  public function getMessage()
156  {
157  return $this->getData(self::MESSAGE);
158  }
159 
163  public function setMessage($message)
164  {
165  return $this->setData(self::MESSAGE, $message);
166  }
167 
173  public function getExtensionAttributes()
174  {
175  return $this->_getExtensionAttributes();
176  }
177 
184  public function setExtensionAttributes(\Magento\GiftMessage\Api\Data\MessageExtensionInterface $extensionAttributes)
185  {
186  return $this->_setExtensionAttributes($extensionAttributes);
187  }
188 
189  //@codeCoverageIgnoreEnd
190 }
$id
Definition: fieldset.phtml:14
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
$resource
Definition: bulk.php:12
$message
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\GiftMessage\Model\TypeFactory $typeFactory, \Magento\GiftMessage\Model\ResourceModel\Message $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
Definition: Message.php:35
$type
Definition: item.phtml:13
setExtensionAttributes(\Magento\GiftMessage\Api\Data\MessageExtensionInterface $extensionAttributes)
Definition: Message.php:184