15
15
use Magento \Framework \Reflection \DataObjectProcessor ;
16
16
use Magento \Cms \Model \ResourceModel \Page as ResourcePage ;
17
17
use Magento \Cms \Model \ResourceModel \Page \CollectionFactory as PageCollectionFactory ;
18
+ use Magento \Store \Model \StoreManagerInterface ;
18
19
19
20
/**
20
21
* Class PageRepository
@@ -57,6 +58,11 @@ class PageRepository implements PageRepositoryInterface
57
58
*/
58
59
protected $ dataPageFactory ;
59
60
61
+ /**
62
+ * @var \Magento\Store\Model\StoreManagerInterface
63
+ */
64
+ private $ storeManager ;
65
+
60
66
/**
61
67
* @param ResourcePage $resource
62
68
* @param PageFactory $pageFactory
@@ -65,6 +71,7 @@ class PageRepository implements PageRepositoryInterface
65
71
* @param Data\PageSearchResultsInterfaceFactory $searchResultsFactory
66
72
* @param DataObjectHelper $dataObjectHelper
67
73
* @param DataObjectProcessor $dataObjectProcessor
74
+ * @param StoreManagerInterface $storeManager
68
75
*/
69
76
public function __construct (
70
77
ResourcePage $ resource ,
@@ -73,7 +80,8 @@ public function __construct(
73
80
PageCollectionFactory $ pageCollectionFactory ,
74
81
Data \PageSearchResultsInterfaceFactory $ searchResultsFactory ,
75
82
DataObjectHelper $ dataObjectHelper ,
76
- DataObjectProcessor $ dataObjectProcessor
83
+ DataObjectProcessor $ dataObjectProcessor ,
84
+ StoreManagerInterface $ storeManager
77
85
) {
78
86
$ this ->resource = $ resource ;
79
87
$ this ->pageFactory = $ pageFactory ;
@@ -82,6 +90,7 @@ public function __construct(
82
90
$ this ->dataObjectHelper = $ dataObjectHelper ;
83
91
$ this ->dataPageFactory = $ dataPageFactory ;
84
92
$ this ->dataObjectProcessor = $ dataObjectProcessor ;
93
+ $ this ->storeManager = $ storeManager ;
85
94
}
86
95
87
96
/**
@@ -93,6 +102,8 @@ public function __construct(
93
102
*/
94
103
public function save (\Magento \Cms \Api \Data \PageInterface $ page )
95
104
{
105
+ $ storeId = $ this ->storeManager ->getStore ()->getId ();
106
+ $ page ->setStoreId ($ storeId );
96
107
try {
97
108
$ this ->resource ->save ($ page );
98
109
} catch (\Exception $ exception ) {
0 commit comments