-
Notifications
You must be signed in to change notification settings - Fork 5
/
doctrine.php
59 lines (47 loc) · 1.67 KB
/
doctrine.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
require_once __DIR__ . '/vendor/autoload.php';
use FOP\Doctrine\Menu\TabManager;
class Doctrine extends Module
{
/**
* In constructor we define our module's meta data.
* It's better to keep constructor (and main module class itself) as thin as possible
* and do any processing in dedicated classes.
*/
public function __construct()
{
$this->name = 'doctrine';
$this->version = '1.0.0';
$this->author = 'Mickaël Andrieu';
$this->need_instance = 0;
$this->ps_versions_compliancy = [
'min' => '1.7.6.0',
'max' => _PS_VERSION_,
];
parent::__construct();
$this->displayName = 'Doctrine example module';
}
/**
* {@inheritdoc}
*/
public function install()
{
parent::install();
TabManager::addTab('AdminDoctrine', 'Doctrine Menu', 'doctrine', 'AdminTools', 'storage');
TabManager::addTab('AdminDoctrineFormClass', 'Controller exemple', 'doctrine', 'AdminDoctrine');
TabManager::addTab('AdminDoctrineGridClass', 'Grid exemple', 'doctrine', 'AdminDoctrine');
Db::getInstance()->execute(
'CREATE TABLE ' . _DB_PREFIX_ . 'demo_entity (id INT AUTO_INCREMENT NOT NULL, isbn VARCHAR(13) NOT NULL, expiration_date DATE NOT NULL, alternative_description LONGTEXT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB'
);
return true;
}
/**
* {@inheritdoc}
*/
public function uninstall()
{
parent::uninstall();
Db::getInstance()->execute('DROP TABLE ' . _DB_PREFIX_ . 'demo_entity');
return true;
}
}