|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Phinx\Migration\AbstractMigration; |
|
4
|
|
|
|
|
5
|
|
|
class PagesData extends AbstractMigration |
|
|
|
|
|
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Migrate Up. |
|
9
|
|
|
*/ |
|
10
|
|
|
public function up() |
|
11
|
|
|
{ |
|
12
|
|
|
$data = [ |
|
13
|
|
|
[ |
|
14
|
|
|
'title' => 'About', |
|
15
|
|
|
'alias' => 'about', |
|
16
|
|
|
'content' => '<p>Describe your site here!</p>', |
|
17
|
|
|
'keywords' => 'about, help', |
|
18
|
|
|
'description' => 'About service', |
|
19
|
|
|
'created' => date('Y-m-d H:i:s'), |
|
20
|
|
|
'userId' => 1 |
|
21
|
|
|
], |
|
22
|
|
|
[ |
|
23
|
|
|
'title' => 'Terms and conditions', |
|
24
|
|
|
'alias' => 'terms-and-conditions', |
|
25
|
|
|
'content' => '<p>Place your terms and conditions here!</p>', |
|
26
|
|
|
'keywords' => 'terms, conditions', |
|
27
|
|
|
'description' => 'Terms and conditions', |
|
28
|
|
|
'created' => date('Y-m-d H:i:s'), |
|
29
|
|
|
'userId' => 1 |
|
30
|
|
|
], |
|
31
|
|
|
[ |
|
32
|
|
|
'title' => 'Legal notices', |
|
33
|
|
|
'alias' => 'legal-notices', |
|
34
|
|
|
'content' => '<p>Place legal notices here!</p>', |
|
35
|
|
|
'keywords' => 'legal notices', |
|
36
|
|
|
'description' => 'Legal notices', |
|
37
|
|
|
'created' => date('Y-m-d H:i:s'), |
|
38
|
|
|
'userId' => 1 |
|
39
|
|
|
] |
|
40
|
|
|
]; |
|
41
|
|
|
|
|
42
|
|
|
$pages = $this->table('pages'); |
|
43
|
|
|
$pages->insert($data) |
|
44
|
|
|
->save(); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Migrate Down. |
|
49
|
|
|
*/ |
|
50
|
|
|
public function down() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->execute('DELETE FROM pages'); |
|
53
|
|
|
} |
|
54
|
|
|
} |
|
55
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.