← All changes
|
modules/variables/services/variables-service.php
+2
-6
4.1.2
→
4.0.0-beta1
View file →
| @@ -166,17 +166,13 @@ | ||
| 166 | 166 | public function restore( string $id, $overrides = [] ) { |
| 167 | 167 | $collection = $this->repo->load(); |
| 168 | 168 | $variable = $collection->find_or_fail( $id ); |
| 169 | 169 | |
| 170 | - $label = $variable->label(); | |
| 170 | + $collection->assert_limit_not_reached(); | |
| 171 | 171 | |
| 172 | 172 | if ( isset( $overrides['label'] ) ) { |
| 173 | - $label = $overrides['label']; | |
| 173 | + $collection->assert_label_is_unique( $overrides['label'], $variable->id() ); | |
| 174 | 174 | } |
| 175 | - | |
| 176 | - $collection->assert_limit_not_reached(); | |
| 177 | - | |
| 178 | - $collection->assert_label_is_unique( $label, $variable->id() ); | |
| 179 | 175 | |
| 180 | 176 | $variable->apply_changes( $overrides ); |
| 181 | 177 | $variable->validate(); |
| 182 | 178 | |