-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInstallData.php
More file actions
43 lines (36 loc) · 1.05 KB
/
InstallData.php
File metadata and controls
43 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace A2bizz\Sample\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
protected $_sampleFactory;
public function __construct(
\A2bizz\Sample\Model\SampleFactory $sampleFactory
)
{
$this->_sampleFactory = $sampleFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$sampleData = [
[
'title' => "Add First Sample Data ",
'content' => "Magento 2 Content, we will garb it with wisywig Editor",
'status' => 1
],
[
'title' => "Add Second Sample Data ",
'content' => "Magento 2 Content, we will garb it with wisywig Editor for second",
'status' => 1
]
];
foreach ($sampleData as $data) {
$sample = $this->_sampleFactory->create();
$sample->addData($data)->save();
}
//$sample = $this->_sampleFactory->create();
//$sample->addData($data)->save();
}
}