@@ 21-30 (lines=10) @@ | ||
18 | $this->listeners[] = $events->attach('configureEntity', [$this, 'handleTableAnnotation']); |
|
19 | } |
|
20 | ||
21 | public function handleTableAnnotation(EventInterface $event) |
|
22 | { |
|
23 | $annotation = $event->getParam('annotation'); |
|
24 | if (!$annotation instanceof Table) { |
|
25 | return; |
|
26 | } |
|
27 | ||
28 | $spec = $event->getParam('spec'); |
|
29 | $spec['table'] = $annotation->getName(); |
|
30 | } |
|
31 | } |
|
32 |
@@ 24-33 (lines=10) @@ | ||
21 | $this->listeners[] = $events->attach('configureProperty', [$this, 'handleManyToManyAnnotation']); |
|
22 | } |
|
23 | ||
24 | public function handleIdAnnotation(EventInterface $event) |
|
25 | { |
|
26 | $annotation = $event->getParam('annotation'); |
|
27 | if (!$annotation instanceof Annotation\Id) { |
|
28 | return; |
|
29 | } |
|
30 | ||
31 | $spec = $event->getParam('spec'); |
|
32 | $spec['autoincrement'] = true; |
|
33 | } |
|
34 | ||
35 | public function handleColumnAnnotation(EventInterface $event) |
|
36 | { |
|
@@ 35-44 (lines=10) @@ | ||
32 | $spec['autoincrement'] = true; |
|
33 | } |
|
34 | ||
35 | public function handleColumnAnnotation(EventInterface $event) |
|
36 | { |
|
37 | $annotation = $event->getParam('annotation'); |
|
38 | if (!$annotation instanceof Annotation\Column) { |
|
39 | return; |
|
40 | } |
|
41 | ||
42 | $spec = $event->getParam('spec'); |
|
43 | $spec['column'] = $annotation->getName(); |
|
44 | } |
|
45 | ||
46 | public function handleOneToOneAnnotation(EventInterface $event) |
|
47 | { |
|
@@ 46-55 (lines=10) @@ | ||
43 | $spec['column'] = $annotation->getName(); |
|
44 | } |
|
45 | ||
46 | public function handleOneToOneAnnotation(EventInterface $event) |
|
47 | { |
|
48 | $annotation = $event->getParam('annotation'); |
|
49 | if (!$annotation instanceof Annotation\OneToOne) { |
|
50 | return; |
|
51 | } |
|
52 | ||
53 | $spec = $event->getParam('spec'); |
|
54 | $spec['oneToOne'] = $annotation->getName(); |
|
55 | } |
|
56 | ||
57 | public function handleOneToManyAnnotation(EventInterface $event) |
|
58 | { |
|
@@ 57-66 (lines=10) @@ | ||
54 | $spec['oneToOne'] = $annotation->getName(); |
|
55 | } |
|
56 | ||
57 | public function handleOneToManyAnnotation(EventInterface $event) |
|
58 | { |
|
59 | $annotation = $event->getParam('annotation'); |
|
60 | if (!$annotation instanceof Annotation\OneToMany) { |
|
61 | return; |
|
62 | } |
|
63 | ||
64 | $spec = $event->getParam('spec'); |
|
65 | $spec['oneToMany'] = $annotation->getName(); |
|
66 | } |
|
67 | ||
68 | public function handleManyToManyAnnotation(EventInterface $event) |
|
69 | { |
|
@@ 68-77 (lines=10) @@ | ||
65 | $spec['oneToMany'] = $annotation->getName(); |
|
66 | } |
|
67 | ||
68 | public function handleManyToManyAnnotation(EventInterface $event) |
|
69 | { |
|
70 | $annotation = $event->getParam('annotation'); |
|
71 | if (!$annotation instanceof Annotation\ManyToMany) { |
|
72 | return; |
|
73 | } |
|
74 | ||
75 | $spec = $event->getParam('spec'); |
|
76 | $spec['manyToMany'] = $annotation->getName(); |
|
77 | } |
|
78 | } |
|
79 |