예제 #1
0
 /**
  * creates mock items and adds to listStatus
  *
  * @return array
  */
 protected function addItems()
 {
     $origin = 'stock';
     $code = 'cataloginventory';
     $message = Data::ERROR_QTY;
     $additionalData = null;
     $mockItems = [];
     for ($i = 0; $i < 2; $i++) {
         $mockItems[] = ['origin' => $origin . $i, 'code' => $code, 'message' => $message . $i, 'additionalData' => $additionalData];
         $this->listStatus->addItem($origin . $i, $code, $message . $i, $additionalData);
     }
     return $mockItems;
 }
예제 #2
0
파일: Item.php 프로젝트: uibar/lavinia2
 /**
  * Adds error information to the quote item.
  * Automatically sets error flag.
  *
  * @param string|null $origin Usually a name of module, that embeds error
  * @param int|null $code Error code, unique for origin, that sets it
  * @param string|null $message Error message
  * @param \Magento\Framework\DataObject|null $additionalData Any additional data, that caller would like to store
  * @return $this
  */
 public function addErrorInfo($origin = null, $code = null, $message = null, $additionalData = null)
 {
     $this->_errorInfos->addItem($origin, $code, $message, $additionalData);
     if ($message !== null) {
         $this->setMessage($message);
     }
     $this->_setHasError(true);
     return $this;
 }