@@ -41,10 +41,10 @@ |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | $registry->getTableSchema($target) |
44 | - ->foreignKey([$outerField->getColumn()]) |
|
45 | - ->references($registry->getTable($source), [$innerField->getColumn()]) |
|
46 | - ->onUpdate($this->getOptions()->get(RelationSchema::FK_ACTION)) |
|
47 | - ->onDelete($this->getOptions()->get(RelationSchema::FK_ACTION)); |
|
44 | + ->foreignKey([$outerField->getColumn()]) |
|
45 | + ->references($registry->getTable($source), [$innerField->getColumn()]) |
|
46 | + ->onUpdate($this->getOptions()->get(RelationSchema::FK_ACTION)) |
|
47 | + ->onDelete($this->getOptions()->get(RelationSchema::FK_ACTION)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 |
@@ -70,10 +70,10 @@ |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | $registry->getTableSchema($target) |
73 | - ->foreignKey(array_map(function (Field $field) { |
|
73 | + ->foreignKey(array_map(function(Field $field) { |
|
74 | 74 | return $field->getColumn(); |
75 | 75 | }, $outerFields)) |
76 | - ->references($registry->getTable($source), array_map(function (Field $field) { |
|
76 | + ->references($registry->getTable($source), array_map(function(Field $field) { |
|
77 | 77 | return $field->getColumn(); |
78 | 78 | }, $innerFields)) |
79 | 79 | ->onUpdate($this->getOptions()->get(RelationSchema::FK_ACTION)) |
@@ -52,7 +52,7 @@ |
||
52 | 52 | protected function getFields(Entity $entity, int $field): array |
53 | 53 | { |
54 | 54 | $fields = []; |
55 | - $keys = (array)$this->getOptions()->get($field); |
|
55 | + $keys = (array) $this->getOptions()->get($field); |
|
56 | 56 | |
57 | 57 | foreach ($keys as $key) { |
58 | 58 | try { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | |
53 | 53 | foreach ($this->findTargets($registry, $interface) as $entity) { |
54 | 54 | $primaryKeys = $entity->getPrimaryKeys(); |
55 | - $primaryFields = array_map(function (string $key) use ($entity) { |
|
55 | + $primaryFields = array_map(function(string $key) use ($entity) { |
|
56 | 56 | return $entity->getFields()->get($key); |
57 | 57 | }, $primaryKeys); |
58 | 58 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | // create target outer field |
65 | 65 | foreach ($this->getFields($target, Relation::OUTER_KEY) as $field) { |
66 | - foreach ((array)$this->options->get(Relation::INNER_KEY) as $innerField) { |
|
66 | + foreach ((array) $this->options->get(Relation::INNER_KEY) as $innerField) { |
|
67 | 67 | $this->ensureField( |
68 | 68 | $source, |
69 | 69 | $innerField, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $table = $registry->getTableSchema($source); |
89 | 89 | |
90 | 90 | if ($this->options->get(self::INDEX_CREATE)) { |
91 | - $table->index(array_map(function (Field $field) { |
|
91 | + $table->index(array_map(function(Field $field) { |
|
92 | 92 | return $field->getColumn(); |
93 | 93 | }, $innerFields)); |
94 | 94 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $target = $registry->getEntity($this->target); |
63 | 63 | |
64 | 64 | // create target outer field |
65 | - foreach ((array)$this->options->get(Relation::INNER_KEY) as $key) { |
|
65 | + foreach ((array) $this->options->get(Relation::INNER_KEY) as $key) { |
|
66 | 66 | foreach ($this->getFields($target, Relation::OUTER_KEY) as $field) { |
67 | 67 | $this->ensureField( |
68 | 68 | $source, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $table = $registry->getTableSchema($source); |
89 | 89 | |
90 | 90 | if ($this->options->get(self::INDEX_CREATE) && count($innerFields) > 0) { |
91 | - $table->index(array_map(function (Field $field) { |
|
91 | + $table->index(array_map(function(Field $field) { |
|
92 | 92 | return $field->getColumn(); |
93 | 93 | }, $innerFields)); |
94 | 94 | } |
@@ -86,7 +86,7 @@ |
||
86 | 86 | $table = $registry->getTableSchema($target); |
87 | 87 | |
88 | 88 | if ($this->options->get(self::INDEX_CREATE) && count($outerFields) > 0) { |
89 | - $table->index(array_map(function (Field $field) { |
|
89 | + $table->index(array_map(function(Field $field) { |
|
90 | 90 | return $field->getColumn(); |
91 | 91 | }, $outerFields)); |
92 | 92 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | // create target outer field |
64 | 64 | foreach ($this->getFields($source, Relation::INNER_KEY) as $field) { |
65 | - foreach ((array)$this->options->get(Relation::OUTER_KEY) as $outerField) { |
|
65 | + foreach ((array) $this->options->get(Relation::OUTER_KEY) as $outerField) { |
|
66 | 66 | $this->ensureField( |
67 | 67 | $target, |
68 | 68 | $outerField, |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | // create target outer field |
64 | 64 | foreach ($this->getFields($source, Relation::INNER_KEY) as $field) { |
65 | - foreach ((array)$this->options->get(Relation::OUTER_KEY) as $outerField) { |
|
65 | + foreach ((array) $this->options->get(Relation::OUTER_KEY) as $outerField) { |
|
66 | 66 | $this->ensureField( |
67 | 67 | $target, |
68 | 68 | $outerField, |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | ]); |
74 | 74 | |
75 | 75 | // create target outer field |
76 | - foreach ((array)$this->options->get(Relation::INNER_KEY) as $i => $key) { |
|
76 | + foreach ((array) $this->options->get(Relation::INNER_KEY) as $i => $key) { |
|
77 | 77 | $this->ensureField( |
78 | 78 | $source, |
79 | 79 | $key, |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ); |
83 | 83 | } |
84 | 84 | |
85 | - foreach ((array)$this->options->get(Relation::MORPH_KEY) as $key) { |
|
85 | + foreach ((array) $this->options->get(Relation::MORPH_KEY) as $key) { |
|
86 | 86 | $this->ensureMorphField( |
87 | 87 | $source, |
88 | 88 | $key, |