-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.php
68 lines (53 loc) · 1.68 KB
/
controller.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
60
61
62
63
64
65
66
67
68
<?php
namespace Concrete\Package\MdAttributeValueUtilities;
use Concrete\Core\Package\Package;
use Concrete\Core\Page\Page;
use Concrete\Core\Page\Single;
use Doctrine\ORM\Tools\SchemaTool;
use Macareux\AttributeValueUtilities\Entity\SelectValueOptionOption;
use Macareux\AttributeValueUtilities\Service\ServiceProvider;
class Controller extends Package
{
protected $pkgHandle = 'md_attribute_value_utilities';
protected $appVersionRequired = '9.0.0';
protected $pkgVersion = '0.1.1';
protected $pkgAutoloaderRegistries = [
'src' => '\Macareux\AttributeValueUtilities',
];
public function getPackageName()
{
return t('Macareux Attribute Value Utilities');
}
public function getPackageDescription()
{
return t('A package that provides a set of utilities to work with attribute values.');
}
public function install()
{
$pkg = parent::install();
$this->installSinglePages();
return $pkg;
}
public function uninstall()
{
$em = $this->getPackageEntityManager();
$schemaTool = new SchemaTool($em);
$classes = [
$em->getClassMetadata(SelectValueOptionOption::class),
];
$schemaTool->dropSchema($classes);
parent::uninstall();
}
public function on_start()
{
$provider = new ServiceProvider($this->app);
$provider->register();
}
private function installSinglePages()
{
$page = Page::getByPath('/dashboard/system/attributes/select_options');
if (!is_object($page) || $page->isError()) {
Single::add('/dashboard/system/attributes/select_options', $this);
}
}
}