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

1 | <?php
2 |
3 | namespace Entity;
4 |
5 | class Category extends ModelBase
6 | {
7 | protected function install()
8 | {
9 | $dbPrefix = $this->getDbPrefix();
10 | $result = self::$dbo->exec("CREATE TABLE IF NOT EXISTS `{$dbPrefix}category` (
11 | `id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
12 | `parent_id` INTEGER(11) UNSIGNED NULL,
13 | FOREIGN KEY (`parent_id`) REFERENCES `{$dbPrefix}category`(id)
14 | )");
15 | if ($result === false)
16 | throw new \Exception(get_class().": ".self::$dbo->errorInfo()[2]);
17 | return true;
18 | }
19 | }
20 |