Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Comment.php
Go to the documentation of this file.
1 <?php
7 
11 
13 {
19  protected $_shipment;
20 
24  protected $_storeManager;
25 
37  public function __construct(
38  \Magento\Framework\Model\Context $context,
39  \Magento\Framework\Registry $registry,
40  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
43  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
44  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
45  array $data = []
46  ) {
47  parent::__construct(
48  $context,
49  $registry,
50  $extensionFactory,
52  $resource,
53  $resourceCollection,
54  $data
55  );
56  $this->_storeManager = $storeManager;
57  }
58 
64  protected function _construct()
65  {
66  $this->_init(\Magento\Sales\Model\ResourceModel\Order\Shipment\Comment::class);
67  }
68 
77  public function setShipment(\Magento\Sales\Model\Order\Shipment $shipment)
78  {
79  $this->_shipment = $shipment;
80  return $this;
81  }
82 
90  public function getShipment()
91  {
92  return $this->_shipment;
93  }
94 
100  public function getStore()
101  {
102  if ($this->getShipment()) {
103  return $this->getShipment()->getStore();
104  }
105  return $this->_storeManager->getStore();
106  }
107 
108  //@codeCoverageIgnoreStart
109 
115  public function getComment()
116  {
118  }
119 
125  public function getCreatedAt()
126  {
128  }
129 
133  public function setCreatedAt($createdAt)
134  {
135  return $this->setData(ShipmentCommentInterface::CREATED_AT, $createdAt);
136  }
137 
143  public function getIsCustomerNotified()
144  {
146  }
147 
153  public function getIsVisibleOnFront()
154  {
156  }
157 
163  public function getParentId()
164  {
166  }
167 
171  public function setParentId($id)
172  {
174  }
175 
179  public function setIsCustomerNotified($isCustomerNotified)
180  {
181  return $this->setData(ShipmentCommentInterface::IS_CUSTOMER_NOTIFIED, $isCustomerNotified);
182  }
183 
187  public function setIsVisibleOnFront($isVisibleOnFront)
188  {
189  return $this->setData(ShipmentCommentInterface::IS_VISIBLE_ON_FRONT, $isVisibleOnFront);
190  }
191 
195  public function setComment($comment)
196  {
197  return $this->setData(ShipmentCommentInterface::COMMENT, $comment);
198  }
199 
205  public function getExtensionAttributes()
206  {
207  return $this->_getExtensionAttributes();
208  }
209 
216  public function setExtensionAttributes(
217  \Magento\Sales\Api\Data\ShipmentCommentExtensionInterface $extensionAttributes
218  ) {
219  return $this->_setExtensionAttributes($extensionAttributes);
220  }
221 
222  //@codeCoverageIgnoreEnd
223 }
setExtensionAttributes(\Magento\Sales\Api\Data\ShipmentCommentExtensionInterface $extensionAttributes)
Definition: Comment.php:216
$id
Definition: fieldset.phtml:14
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
$storeManager
$resource
Definition: bulk.php:12
setIsCustomerNotified($isCustomerNotified)
Definition: Comment.php:179
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
Definition: Comment.php:37
setShipment(\Magento\Sales\Model\Order\Shipment $shipment)
Definition: Comment.php:77
foreach($order->getItems() as $orderItem) $shipment