/
Version20140919000000.php
50 lines (45 loc) · 1.41 KB
/
Version20140919000000.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
<?php
namespace Concrete\Core\Updater\Migrations\Migrations;
use Concrete\Core\Permission\Access\Entity\Type;
use Concrete\Core\Permission\Category;
use Concrete\Core\Updater\Migrations\AbstractMigration;
use Concrete\Core\Updater\Migrations\RepeatableMigrationInterface;
class Version20140919000000 extends AbstractMigration implements RepeatableMigrationInterface
{
/**
* {@inheritdoc}
*
* @see \Doctrine\Migrations\AbstractMigration::getDescription()
*/
public function getDescription(): string
{
return '5.7.0.2';
}
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Updater\Migrations\AbstractMigration::upgradeDatabase()
*/
public function upgradeDatabase()
{
// assign the page owner access entity to the page type category
$pe = Type::getByHandle('page_owner');
$category = Category::getByHandle('page_type');
if (is_object($category) && is_object($pe)) {
$category->associateAccessEntityType($pe);
}
}
/**
* {@inheritdoc}
*
* @see \Concrete\Core\Updater\Migrations\AbstractMigration::downgradeDatabase()
*/
public function downgradeDatabase()
{
$pe = Type::getByHandle('page_owner');
$category = Category::getByHandle('page_type');
if (is_object($category) && is_object($pe)) {
$category->deassociateAccessEntityType($pe);
}
}
}