@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | $insertSql = new \Sirius\Sql\Insert($connection); |
31 | 31 | $insertSql->into($this->mapper->getConfig()->getTable()) |
32 | - ->columns($columns); |
|
32 | + ->columns($columns); |
|
33 | 33 | $insertSql->perform(); |
34 | 34 | |
35 | 35 | /** |
@@ -23,10 +23,10 @@ |
||
23 | 23 | |
24 | 24 | $update = new \Sirius\Sql\Update($this->mapper->getWriteConnection()); |
25 | 25 | $update->table($this->mapper->getConfig()->getTable()) |
26 | - ->columns([ |
|
27 | - $this->getOption('deleted_at_column') => $this->now |
|
28 | - ]) |
|
29 | - ->where('id', $entityId); |
|
26 | + ->columns([ |
|
27 | + $this->getOption('deleted_at_column') => $this->now |
|
28 | + ]) |
|
29 | + ->where('id', $entityId); |
|
30 | 30 | $update->perform(); |
31 | 31 | } |
32 | 32 |
@@ -54,8 +54,8 @@ |
||
54 | 54 | if (count($columns) > 0) { |
55 | 55 | $updateSql = new \Sirius\Sql\Update($connection); |
56 | 56 | $updateSql->table($this->mapper->getConfig()->getTable()) |
57 | - ->columns($columns) |
|
58 | - ->whereAll($conditions, false); |
|
57 | + ->columns($columns) |
|
58 | + ->whereAll($conditions, false); |
|
59 | 59 | $updateSql->perform(); |
60 | 60 | } |
61 | 61 | } |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | private function addFirstMethod() |
65 | 65 | { |
66 | 66 | $method = $this->class->addMethod('first') |
67 | - ->setReturnNullable(true) |
|
68 | - ->setReturnType($this->mapper->getEntityClass()); |
|
67 | + ->setReturnNullable(true) |
|
68 | + ->setReturnType($this->mapper->getEntityClass()); |
|
69 | 69 | $method->setBody('return parent::first();'); |
70 | 70 | } |
71 | 71 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $this->namespace->addUse(Collection::class); |
75 | 75 | $method = $this->class->addMethod('get') |
76 | - ->setReturnType('Collection'); |
|
76 | + ->setReturnType('Collection'); |
|
77 | 77 | $method->setBody('return parent::get();'); |
78 | 78 | $method->addComment(sprintf('@return Collection|%s[]', $this->mapper->getEntityClass())); |
79 | 79 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | $this->namespace->addUse(PaginatedCollection::class); |
84 | 84 | $method = $this->class->addMethod('paginate') |
85 | - ->setReturnType('PaginatedCollection'); |
|
85 | + ->setReturnType('PaginatedCollection'); |
|
86 | 86 | $method->addParameter('perPage')->setType('int'); |
87 | 87 | $method->addParameter('page', 1)->setType('int'); |
88 | 88 | $method->setBody('return parent::paginate($perPage, $page);'); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function joinSubselect(Query $query, string $reference) |
49 | 49 | { |
50 | 50 | $subselect = $query->subSelectForJoinWith($this->foreignMapper) |
51 | - ->as($reference); |
|
51 | + ->as($reference); |
|
52 | 52 | |
53 | 53 | $subselect = $this->applyQueryCallback($subselect); |
54 | 54 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | public function joinSubselect(Query $query, string $reference) |
49 | 49 | { |
50 | 50 | $subselect = $query->subSelectForJoinWith($this->foreignMapper) |
51 | - ->as($reference); |
|
51 | + ->as($reference); |
|
52 | 52 | |
53 | 53 | $subselect = $this->applyQueryCallback($subselect); |
54 | 54 |
@@ -56,7 +56,7 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $constructor = $this->class->addMethod('__construct') |
59 | - ->setBody('parent::__construct($attributes, $state);'); |
|
59 | + ->setBody('parent::__construct($attributes, $state);'); |
|
60 | 60 | $constructor->addParameter('attributes') |
61 | 61 | ->setType('array') |
62 | 62 | ->setDefaultValue([]); |
@@ -78,14 +78,14 @@ |
||
78 | 78 | $setter->setVisibility(ClassType::VISIBILITY_PUBLIC); |
79 | 79 | $setter->addParameter('value') |
80 | 80 | ->setType($type) |
81 | - ->setNullable($this->attributeIsNullable()); |
|
81 | + ->setNullable($this->attributeIsNullable()); |
|
82 | 82 | $setter->addBody('$this->set(\'' . $name . '\', $value);'); |
83 | 83 | |
84 | 84 | $getter = $class->addMethod(Str::methodName($name, 'get')); |
85 | 85 | $getter->setVisibility(ClassType::VISIBILITY_PUBLIC); |
86 | 86 | $getter->addBody('return $this->get(\'' . $name . '\');'); |
87 | 87 | $getter->setReturnType($type) |
88 | - ->setReturnNullable($this->attributeIsNullable()); |
|
88 | + ->setReturnNullable($this->attributeIsNullable()); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $class; |
@@ -134,86 +134,86 @@ |
||
134 | 134 | public static function varchar(string $name, $length = 255) |
135 | 135 | { |
136 | 136 | return static::make($name) |
137 | - ->setType(static::TYPE_VARCHAR) |
|
138 | - ->setLength($length); |
|
137 | + ->setType(static::TYPE_VARCHAR) |
|
138 | + ->setLength($length); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | public static function bool(string $name) |
142 | 142 | { |
143 | 143 | return static::make($name) |
144 | - ->setType(static::TYPE_BOOLEAN); |
|
144 | + ->setType(static::TYPE_BOOLEAN); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | public static function string(string $name) |
148 | 148 | { |
149 | 149 | return static::make($name) |
150 | - ->setType(static::TYPE_TEXT); |
|
150 | + ->setType(static::TYPE_TEXT); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public static function datetime(string $name) |
154 | 154 | { |
155 | 155 | return static::make($name) |
156 | - ->setType(static::TYPE_DATETIME); |
|
156 | + ->setType(static::TYPE_DATETIME); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | public static function date(string $name) |
160 | 160 | { |
161 | 161 | return static::make($name) |
162 | - ->setType(static::TYPE_DATE); |
|
162 | + ->setType(static::TYPE_DATE); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | public static function timestamp(string $name) |
166 | 166 | { |
167 | 167 | return static::make($name) |
168 | - ->setType(static::TYPE_TIMESTAMP); |
|
168 | + ->setType(static::TYPE_TIMESTAMP); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | public static function json(string $name) |
172 | 172 | { |
173 | 173 | return static::make($name) |
174 | - ->setType(static::TYPE_JSON); |
|
174 | + ->setType(static::TYPE_JSON); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | public static function float(string $name) |
178 | 178 | { |
179 | 179 | return static::make($name) |
180 | - ->setType(static::TYPE_FLOAT); |
|
180 | + ->setType(static::TYPE_FLOAT); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | public static function integer(string $name, $unsigned = false) |
184 | 184 | { |
185 | 185 | return static::make($name) |
186 | - ->setType(static::TYPE_INTEGER) |
|
187 | - ->setUnsigned($unsigned); |
|
186 | + ->setType(static::TYPE_INTEGER) |
|
187 | + ->setUnsigned($unsigned); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public static function tinyInteger(string $name, $unsigned = false) |
191 | 191 | { |
192 | 192 | return static::make($name) |
193 | - ->setType(static::TYPE_TINY_INTEGER) |
|
194 | - ->setUnsigned($unsigned); |
|
193 | + ->setType(static::TYPE_TINY_INTEGER) |
|
194 | + ->setUnsigned($unsigned); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public static function smallInteger(string $name, $unsigned = false) |
198 | 198 | { |
199 | 199 | return static::make($name) |
200 | - ->setType(static::TYPE_SMALL_INTEGER) |
|
201 | - ->setUnsigned($unsigned); |
|
200 | + ->setType(static::TYPE_SMALL_INTEGER) |
|
201 | + ->setUnsigned($unsigned); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | public static function bigInteger(string $name, $unsigned = false) |
205 | 205 | { |
206 | 206 | return static::make($name) |
207 | - ->setType(static::TYPE_BIG_INTEGER) |
|
208 | - ->setUnsigned($unsigned); |
|
207 | + ->setType(static::TYPE_BIG_INTEGER) |
|
208 | + ->setUnsigned($unsigned); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | public static function decimal(string $name, int $digits, int $precision) |
212 | 212 | { |
213 | 213 | return static::make($name) |
214 | - ->setType(static::TYPE_DECIMAL) |
|
215 | - ->setDigits($digits) |
|
216 | - ->setPrecision($precision); |
|
214 | + ->setType(static::TYPE_DECIMAL) |
|
215 | + ->setDigits($digits) |
|
216 | + ->setPrecision($precision); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | public function getErrors(): array |