| @@ -191,19 +191,19 @@ | ||
| 191 | 191 | break; | 
| 192 | 192 | } | 
| 193 | 193 | |
| 194 | - if ( $dbobject->id > 0 | |
| 194 | + if ($dbobject->id > 0 | |
| 195 | 195 |              && $dbobject->metadata->revised->format('U') >= $object->metadata->revised->format('U')) { | 
| 196 | 196 | exception::object_imported(); | 
| 197 | 197 | return false; | 
| 198 | 198 | } | 
| 199 | 199 | |
| 200 | - if ( $dbobject->metadata->deleted | |
| 200 | + if ($dbobject->metadata->deleted | |
| 201 | 201 |              && !$object->metadata->deleted) { | 
| 202 | 202 |              if (!midgard_object_class::undelete($dbobject->guid)) { | 
| 203 | 203 | return false; | 
| 204 | 204 | } | 
| 205 | 205 | $dbobject->metadata_deleted = false; | 
| 206 | - } elseif ( !$dbobject->metadata->deleted | |
| 206 | + } elseif (!$dbobject->metadata->deleted | |
| 207 | 207 |                   && $object->metadata->deleted) { | 
| 208 | 208 | return $dbobject->delete(); | 
| 209 | 209 | } | 
| @@ -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 | } | 
| @@ -219,7 +219,7 @@ discard block | ||
| 219 | 219 | exception::invalid_property_value(); | 
| 220 | 220 | return false; | 
| 221 | 221 | } | 
| 222 | - if ( $check_dependencies | |
| 222 | + if ($check_dependencies | |
| 223 | 223 |              && $this->has_dependents()) { | 
| 224 | 224 | exception::has_dependants(); | 
| 225 | 225 | return false; | 
| @@ -304,7 +304,7 @@ discard block | ||
| 304 | 304 |      { | 
| 305 | 305 | $this->initialize(); | 
| 306 | 306 | |
| 307 | - if ( empty($this->cm->midgard['parentfield']) | |
| 307 | + if (empty($this->cm->midgard['parentfield']) | |
| 308 | 308 |              || empty($this->cm->midgard['parent'])) { | 
| 309 | 309 | return true; | 
| 310 | 310 | } | 
| @@ -321,7 +321,7 @@ discard block | ||
| 321 | 321 | $this->initialize(); | 
| 322 | 322 | |
| 323 | 323 |          foreach ($this->cm->fieldMappings as $name => $field) { | 
| 324 | - if ( $field['midgard:midgard_type'] == translator::TYPE_GUID | |
| 324 | + if ($field['midgard:midgard_type'] == translator::TYPE_GUID | |
| 325 | 325 | && !empty($this->$name) | 
| 326 | 326 |                  && !mgd_is_guid($this->$name)) { | 
| 327 | 327 |                  exception::invalid_property_value("'" . $name . "' property's value is not a guid."); | 
| @@ -333,7 +333,7 @@ discard block | ||
| 333 | 333 | |
| 334 | 334 | private function check_upfield() : bool | 
| 335 | 335 |      { | 
| 336 | - if ( !empty($this->id) | |
| 336 | + if (!empty($this->id) | |
| 337 | 337 | && !empty($this->cm->midgard['upfield']) | 
| 338 | 338 | && $this->__get($this->cm->midgard['upfield']) === $this->id | 
| 339 | 339 |              && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) { | 
| @@ -370,7 +370,7 @@ discard block | ||
| 370 | 370 | $stat = $results > 0; | 
| 371 | 371 | } | 
| 372 | 372 | |
| 373 | - if ( !$stat | |
| 373 | + if (!$stat | |
| 374 | 374 |              && !empty($this->cm->midgard['childtypes'])) { | 
| 375 | 375 |              foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { | 
| 376 | 376 | $qb = connection::get_em()->createQueryBuilder(); | 
| @@ -679,7 +679,7 @@ discard block | ||
| 679 | 679 | exception::not_exists(); | 
| 680 | 680 | return false; | 
| 681 | 681 | } | 
| 682 | - if ( $check_dependencies | |
| 682 | + if ($check_dependencies | |
| 683 | 683 |              && $this->has_dependents()) { | 
| 684 | 684 | exception::has_dependants(); | 
| 685 | 685 | return false; |