-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAddData.php
59 lines (54 loc) · 1.61 KB
/
AddData.php
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* @category BDCrops
* @package BDC\SimpleNews
* @news Abdul Matin <[email protected] / [email protected] >
* @copyright Copyright (c) 2018 BDCrops, Ltd (http://www.bdcrops.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
namespace BDC\SimpleNews\Setup\Patch\Data;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
use Magento\Framework\Module\Setup\Migration;
use Magento\Framework\Setup\ModuleDataSetupInterface;
/**
* Class AddData
* @package BDC\SimpleNews\Setup\Patch\Data
*/
class AddData implements DataPatchInterface, PatchVersionInterface {
/**
* @var \BDC\SimpleNews\Model\News
*/
private $news;
/**
* @param \BDC\SimpleNews\Model\News $news
*/
public function __construct( \BDC\SimpleNews\Model\News $news ) {
$this->news = $news;
}
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function apply(){
$newsData = [];
$newsData['title'] = "BDC News Head1";
$newsData['summary'] = "BDC News Summary";
$newsData['description'] = "BDCrops Inc description evulation of bangladesh";
//$newsData['status'] = 1;
$this->news->addData($newsData);
$this->news->getResource()->save($this->news);
}
/**
* {@inheritdoc}
*/
public static function getDependencies() { return []; }
/**
* {@inheritdoc}
*/
public static function getVersion() { return '2.0.0'; }
/**
* {@inheritdoc}
*/
public function getAliases() { return []; }
}