@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function __get($field) |
| 80 | 80 | { |
| 81 | - if ( $field === 'metadata' |
|
| 81 | + if ($field === 'metadata' |
|
| 82 | 82 | && $this->metadata === null |
| 83 | 83 | && $this instanceof metadata_interface) { |
| 84 | 84 | $this->metadata = new metadata($this); |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | protected function load_parent(array $candidates) : ?dbobject |
| 99 | 99 | { |
| 100 | 100 | foreach ($candidates as $candidate) { |
| 101 | - if ( is_string($this->$candidate) |
|
| 101 | + if (is_string($this->$candidate) |
|
| 102 | 102 | && mgd_is_guid($this->$candidate)) { |
| 103 | 103 | return \midgard_object_class::get_object_by_guid($this->$candidate); |
| 104 | 104 | } |
| 105 | 105 | if ($this->$candidate !== null) { |
| 106 | 106 | //Proxies become stale if the object itself is detached, so we have to re-fetch |
| 107 | - if ( $this->$candidate instanceof Proxy |
|
| 107 | + if ($this->$candidate instanceof Proxy |
|
| 108 | 108 | && $this->$candidate->__isInitialized()) { |
| 109 | 109 | try { |
| 110 | 110 | $this->$candidate->get_by_id($this->$candidate->id); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | exception::duplicate(); |
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | - if ( !$this->is_unique() |
|
| 174 | + if (!$this->is_unique() |
|
| 175 | 175 | || !$this->check_parent()) { |
| 176 | 176 | return false; |
| 177 | 177 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | midgard_connection::get_instance()->set_error(MGD_ERR_INVALID_PROPERTY_VALUE); |
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | - if ( $check_dependencies |
|
| 225 | + if ($check_dependencies |
|
| 226 | 226 | && $this->has_dependents()) { |
| 227 | 227 | exception::has_dependants(); |
| 228 | 228 | return false; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | { |
| 309 | 309 | $this->initialize(); |
| 310 | 310 | |
| 311 | - if ( empty($this->cm->midgard['parentfield']) |
|
| 311 | + if (empty($this->cm->midgard['parentfield']) |
|
| 312 | 312 | || empty($this->cm->midgard['parent'])) { |
| 313 | 313 | return true; |
| 314 | 314 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $this->initialize(); |
| 326 | 326 | |
| 327 | 327 | foreach ($this->cm->fieldMappings as $name => $field) { |
| 328 | - if ( $field['midgard:midgard_type'] == translator::TYPE_GUID |
|
| 328 | + if ($field['midgard:midgard_type'] == translator::TYPE_GUID |
|
| 329 | 329 | && !empty($this->$name) |
| 330 | 330 | && !mgd_is_guid($this->$name)) { |
| 331 | 331 | exception::invalid_property_value("'" . $name . "' property's value is not a guid."); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | private function check_upfield() : bool |
| 339 | 339 | { |
| 340 | - if ( !empty($this->id) |
|
| 340 | + if (!empty($this->id) |
|
| 341 | 341 | && !empty($this->cm->midgard['upfield']) |
| 342 | 342 | && $this->__get($this->cm->midgard['upfield']) === $this->id |
| 343 | 343 | && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) { |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | $stat = $results > 0; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if ( !$stat |
|
| 377 | + if (!$stat |
|
| 378 | 378 | && !empty($this->cm->midgard['childtypes'])) { |
| 379 | 379 | foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { |
| 380 | 380 | $qb = connection::get_em()->createQueryBuilder(); |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | exception::not_exists(); |
| 686 | 686 | return false; |
| 687 | 687 | } |
| 688 | - if ( $check_dependencies |
|
| 688 | + if ($check_dependencies |
|
| 689 | 689 | && $this->has_dependents()) { |
| 690 | 690 | exception::has_dependants(); |
| 691 | 691 | return false; |