| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 2 / 2 | CRAP | 100.00% covered (success) | 100.00% | 9 / 9
ModuleHook | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 2 / 2 | 3 | 100.00% covered (success) | 100.00% | 9 / 9
install | 100.00% covered (success) | 100.00% | 1 / 1 | 2 | 100.00% covered (success) | 100.00% | 7 / 7
getModules | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 2 / 2

1 | <?php
2 |
3 | namespace Entity;
4 |
5 | class ModuleHook extends ModelBase
6 | {
7 | protected function install()
8 | {
9 | $dbPrefix = $this->getDbPrefix();
10 | $result = self::$dbo->exec("CREATE TABLE IF NOT EXISTS `{$dbPrefix}modulehook` (
11 | `id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
12 | `module_id` INTEGER(11) UNSIGNED NOT NULL,
13 | `hookName` VARCHAR(32) NOT NULL,
14 | `hookPosition` INTEGER(11) NOT NULL,
15 | FOREIGN KEY (`module_id`) REFERENCES `{$dbPrefix}module`(id),
16 | UNIQUE(`module_id`, `hookName`)
17 | )");
18 | if ($result === false)
19 | throw new \Exception(get_class().": ".self::$dbo->errorInfo()[2]);
20 | return true;
21 | }
22 |
23 | public static function getModules($moduleIds)
24 | {
25 | $fetcher = new self();
26 | return $fetcher->selects(array("module_id" => $moduleIds), array("hookName", "hookPosition"));
27 | }
28 | }
29 |