1 | <?php |
||
20 | trait MorphedTrait |
||
21 | { |
||
22 | /** |
||
23 | * Resolving outer key. |
||
24 | * |
||
25 | * @param \Spiral\ORM\Schemas\SchemaBuilder $builder |
||
26 | * |
||
27 | * @return \Spiral\Database\Schemas\Prototypes\AbstractColumn|null When no outer records found |
||
28 | * NULL will be returned. |
||
29 | */ |
||
30 | protected function findOuter(SchemaBuilder $builder) |
||
53 | |||
54 | /** |
||
55 | * Make sure all tables have same outer key. |
||
56 | * |
||
57 | * @param \Spiral\ORM\Schemas\SchemaBuilder $builder |
||
58 | * @param \Spiral\Database\Schemas\Prototypes\AbstractColumn $column |
||
59 | * |
||
60 | * @throws RelationSchemaException |
||
61 | */ |
||
62 | protected function verifyOuter(SchemaBuilder $builder, AbstractColumn $column) |
||
84 | |||
85 | /** |
||
86 | * Find all matched schemas. |
||
87 | * |
||
88 | * @param \Spiral\ORM\Schemas\SchemaBuilder $builder |
||
89 | * |
||
90 | * @return \Generator|\Spiral\ORM\Schemas\SchemaInterface[] |
||
91 | */ |
||
92 | protected function findTargets(SchemaBuilder $builder): \Generator |
||
102 | |||
103 | /** |
||
104 | * @return \Spiral\ORM\Schemas\Definitions\RelationDefinition |
||
105 | */ |
||
106 | abstract public function getDefinition(): RelationDefinition; |
||
107 | |||
108 | /** |
||
109 | * @param string $key |
||
110 | * |
||
111 | * @return mixed |
||
112 | */ |
||
113 | abstract protected function option(string $key); |
||
114 | } |