Пример #1
0
 /**
  * Save file to storage
  *
  * @param  array $file
  * @return $this
  */
 public function saveFile($file)
 {
     $connection = $this->getConnection();
     $contentParam = new \Magento\Framework\DB\Statement\Parameter($file['content']);
     $contentParam->setIsBlob(true);
     $data = ['content' => $contentParam, 'upload_time' => $file['update_time'], 'filename' => $file['filename'], 'directory_id' => $file['directory_id'], 'directory' => $file['directory']];
     $connection->insertOnDuplicate($this->getMainTable(), $data, ['content', 'upload_time']);
     return $this;
 }
Пример #2
0
 /**
  * Save file to storage
  *
  * @param  array $file
  * @return $this
  */
 public function saveFile($file)
 {
     $adapter = $this->_getWriteAdapter();
     $contentParam = new \Magento\Framework\DB\Statement\Parameter($file['content']);
     $contentParam->setIsBlob(true);
     $data = array('content' => $contentParam, 'upload_time' => $file['update_time'], 'filename' => $file['filename'], 'directory_id' => $file['directory_id'], 'directory' => $file['directory']);
     $adapter->insertOnDuplicate($this->getMainTable(), $data, array('content', 'upload_time'));
     return $this;
 }