1 | <?php |
||
14 | abstract class Entitizer extends Entitizer\Utils\Cache { |
||
15 | |||
16 | private static $error_message = 'The entity class for the given table does not exist'; |
||
17 | |||
18 | # Entities classes |
||
19 | |||
20 | protected static $classes = [ |
||
21 | |||
22 | TABLE_PAGES => 'Modules\Entitizer\Entity\Page', |
||
23 | TABLE_MENU => 'Modules\Entitizer\Entity\Menuitem', |
||
24 | TABLE_VARIABLES => 'Modules\Entitizer\Entity\Variable', |
||
25 | TABLE_WIDGETS => 'Modules\Entitizer\Entity\Widget', |
||
26 | TABLE_USERS => 'Modules\Entitizer\Entity\User', |
||
27 | TABLE_USERS_SECRETS => 'Modules\Entitizer\Entity\User\Secret', |
||
28 | TABLE_USERS_SESSIONS => 'Modules\Entitizer\Entity\User\Session' |
||
29 | ]; |
||
30 | |||
31 | /** |
||
32 | * Get an entity object by a given type (a table name) and an id. If the entity has not been already loaded, |
||
33 | * it will be selected from database, otherwise the cached object will be returned. |
||
34 | * If the id is not given or equals 0, an empty entity will be returned. |
||
35 | * If the table name is invalid, an exception will be thrown |
||
36 | */ |
||
37 | |||
38 | public static function get(string $table, int $id = 0) : Entitizer\Utils\Entity { |
||
50 | |||
51 | /** |
||
52 | * Get a dataset object with a custom data |
||
53 | */ |
||
54 | |||
55 | public static function getDataset(string $table, array $data = []) : Entitizer\Utils\Dataset { |
||
59 | |||
60 | /** |
||
61 | * Get a definition object |
||
62 | */ |
||
63 | |||
64 | public static function getDefinition(string $table) : Entitizer\Utils\Definition { |
||
68 | |||
69 | /** |
||
70 | * Get a listview object |
||
71 | */ |
||
72 | |||
73 | public static function getListview(string $table) : Entitizer\Utils\Listview { |
||
77 | |||
78 | /** |
||
79 | * Get a treeview object |
||
80 | */ |
||
81 | |||
82 | public static function getTreeview(string $table) : Entitizer\Utils\Treeview { |
||
86 | } |
||
87 | } |
||
88 |