/**
  * Save Page data
  *
  * @param \Magento\Cms\Api\Data\PageInterface $page
  * @return Page
  * @throws CouldNotSaveException
  */
 public function save(\Magento\Cms\Api\Data\PageInterface $page)
 {
     try {
         $this->resource->save($page);
     } catch (\Exception $exception) {
         throw new CouldNotSaveException(__($exception->getMessage()));
     }
     return $page;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function save(\Magento\Framework\Model\AbstractModel $object)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'save');
     if (!$pluginInfo) {
         return parent::save($object);
     } else {
         return $this->___callPlugins('save', func_get_args(), $pluginInfo);
     }
 }
 /**
  * Save Page data
  *
  * @param \Magento\Cms\Api\Data\PageInterface $page
  * @return Page
  * @throws CouldNotSaveException
  */
 public function save(\Magento\Cms\Api\Data\PageInterface $page)
 {
     $storeId = $this->storeManager->getStore()->getId();
     $page->setStoreId($storeId);
     try {
         $this->resource->save($page);
     } catch (\Exception $exception) {
         throw new CouldNotSaveException(__($exception->getMessage()));
     }
     return $page;
 }
Example #4
0
 public function testSave()
 {
     $this->entityManagerMock->expects($this->once())->method('save')->with($this->pageMock, [])->willReturn(true);
     $this->assertInstanceOf(PageResourceModel::class, $this->model->save($this->pageMock));
 }