Skip to content

Commit d90888d

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-58383' into 2.1-develop-pr45
2 parents 0334cf3 + 192894b commit d90888d

File tree

8 files changed

+422
-154
lines changed

8 files changed

+422
-154
lines changed

app/code/Magento/Cms/Controller/Adminhtml/Page/Save.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,32 @@ class Save extends \Magento\Backend\App\Action
3535
*/
3636
private $pageFactory;
3737

38+
/**
39+
* @var \Magento\Cms\Api\PageRepositoryInterface
40+
*/
41+
private $pageRepository;
42+
3843
/**
3944
* @param Action\Context $context
4045
* @param PostDataProcessor $dataProcessor
4146
* @param DataPersistorInterface $dataPersistor
4247
* @param \Magento\Cms\Model\PageFactory $pageFactory
48+
* @param \Magento\Cms\Api\PageRepositoryInterface $pageRepository
4349
*/
4450
public function __construct(
4551
Action\Context $context,
4652
PostDataProcessor $dataProcessor,
4753
DataPersistorInterface $dataPersistor,
48-
\Magento\Cms\Model\PageFactory $pageFactory = null
54+
\Magento\Cms\Model\PageFactory $pageFactory = null,
55+
\Magento\Cms\Api\PageRepositoryInterface $pageRepository = null
4956
) {
5057
$this->dataProcessor = $dataProcessor;
5158
$this->dataPersistor = $dataPersistor;
5259
$this->pageFactory = $pageFactory
5360
?: \Magento\Framework\App\ObjectManager::getInstance()->get(\Magento\Cms\Model\PageFactory::class);
61+
$this->pageRepository = $pageRepository
62+
?: \Magento\Framework\App\ObjectManager::getInstance()
63+
->get(\Magento\Cms\Api\PageRepositoryInterface::class);
5464

5565
parent::__construct($context);
5666
}
@@ -102,7 +112,7 @@ public function execute()
102112
}
103113

104114
try {
105-
$model->save();
115+
$this->pageRepository->save($model);
106116
$this->messageManager->addSuccess(__('You saved the page.'));
107117
$this->dataPersistor->clear('cms_page');
108118
if ($this->getRequest()->getParam('back')) {

0 commit comments

Comments
 (0)