@@ 11-24 (lines=14) @@ | ||
8 | use PhpBoot\ORM\ModelContainer; |
|
9 | use PhpBoot\Utils\AnnotationParams; |
|
10 | ||
11 | class PKAnnotationHandler |
|
12 | { |
|
13 | /** |
|
14 | * @param ModelContainer $container |
|
15 | * @param AnnotationBlock|AnnotationTag $ann |
|
16 | */ |
|
17 | public function __invoke(ModelContainer $container, $ann) |
|
18 | { |
|
19 | $params = new AnnotationParams($ann->description, 2); |
|
20 | $table = $params->getParam(0) or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} require at least one param, 0 given")); |
|
21 | ||
22 | $container->setPk($table); |
|
23 | } |
|
24 | } |
@@ 10-23 (lines=14) @@ | ||
7 | use PhpBoot\ORM\ModelContainer; |
|
8 | use PhpBoot\Utils\AnnotationParams; |
|
9 | ||
10 | class TableAnnotationHandler |
|
11 | { |
|
12 | /** |
|
13 | * @param ModelContainer $container |
|
14 | * @param AnnotationBlock|AnnotationTag $ann |
|
15 | */ |
|
16 | public function __invoke(ModelContainer $container, $ann) |
|
17 | { |
|
18 | $params = new AnnotationParams($ann->description, 2); |
|
19 | $table = $params->getParam(0) or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} require at least one param, 0 given")); |
|
20 | ||
21 | $container->setTable($table); |
|
22 | } |
|
23 | } |