@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | public function __get($field) |
| 79 | 79 | { |
| 80 | - if ( $field === 'metadata' |
|
| 80 | + if ($field === 'metadata' |
|
| 81 | 81 | && $this->metadata === null |
| 82 | 82 | && $this instanceof metadata_interface) { |
| 83 | 83 | $this->metadata = new metadata($this); |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | protected function load_parent(array $candidates) : ?dbobject |
| 98 | 98 | { |
| 99 | 99 | foreach ($candidates as $candidate) { |
| 100 | - if ( is_string($this->$candidate) |
|
| 100 | + if (is_string($this->$candidate) |
|
| 101 | 101 | && mgd_is_guid($this->$candidate)) { |
| 102 | 102 | return \midgard_object_class::get_object_by_guid($this->$candidate); |
| 103 | 103 | } |
| 104 | 104 | if ($this->$candidate !== null) { |
| 105 | 105 | //Proxies become stale if the object itself is detached, so we have to re-fetch |
| 106 | - if ( $this->$candidate instanceof Proxy |
|
| 106 | + if ($this->$candidate instanceof Proxy |
|
| 107 | 107 | && $this->$candidate->__isInitialized()) { |
| 108 | 108 | try { |
| 109 | 109 | $this->$candidate->get_by_id($this->$candidate->id); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | // According to Doctrine documentation, proxies should be transparent, but in practice, |
| 129 | 129 | // there will be problems if we don't force-load |
| 130 | - if ( $entity instanceof Proxy |
|
| 130 | + if ($entity instanceof Proxy |
|
| 131 | 131 | && !$entity->__isInitialized()) { |
| 132 | 132 | try { |
| 133 | 133 | $entity->__load(); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | exception::duplicate(); |
| 174 | 174 | return false; |
| 175 | 175 | } |
| 176 | - if ( !$this->is_unique() |
|
| 176 | + if (!$this->is_unique() |
|
| 177 | 177 | || !$this->check_parent()) { |
| 178 | 178 | return false; |
| 179 | 179 | } |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | midgard_connection::get_instance()->set_error(MGD_ERR_INVALID_PROPERTY_VALUE); |
| 225 | 225 | return false; |
| 226 | 226 | } |
| 227 | - if ( $check_dependencies |
|
| 227 | + if ($check_dependencies |
|
| 228 | 228 | && $this->has_dependents()) { |
| 229 | 229 | exception::has_dependants(); |
| 230 | 230 | return false; |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | { |
| 311 | 311 | $this->initialize(); |
| 312 | 312 | |
| 313 | - if ( empty($this->cm->midgard['parentfield']) |
|
| 313 | + if (empty($this->cm->midgard['parentfield']) |
|
| 314 | 314 | || empty($this->cm->midgard['parent'])) { |
| 315 | 315 | return true; |
| 316 | 316 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $this->initialize(); |
| 328 | 328 | |
| 329 | 329 | foreach ($this->cm->fieldMappings as $name => $field) { |
| 330 | - if ( $field['midgard:midgard_type'] == translator::TYPE_GUID |
|
| 330 | + if ($field['midgard:midgard_type'] == translator::TYPE_GUID |
|
| 331 | 331 | && !empty($this->$name) |
| 332 | 332 | && !mgd_is_guid($this->$name)) { |
| 333 | 333 | exception::invalid_property_value("'" . $name . "' property's value is not a guid."); |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | private function check_upfield() : bool |
| 341 | 341 | { |
| 342 | - if ( !empty($this->id) |
|
| 342 | + if (!empty($this->id) |
|
| 343 | 343 | && !empty($this->cm->midgard['upfield']) |
| 344 | 344 | && $this->__get($this->cm->midgard['upfield']) === $this->id |
| 345 | 345 | && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | $stat = $results > 0; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( !$stat |
|
| 379 | + if (!$stat |
|
| 380 | 380 | && !empty($this->cm->midgard['childtypes'])) { |
| 381 | 381 | foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { |
| 382 | 382 | $qb = connection::get_em()->createQueryBuilder(); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | exception::not_exists(); |
| 688 | 688 | return false; |
| 689 | 689 | } |
| 690 | - if ( $check_dependencies |
|
| 690 | + if ($check_dependencies |
|
| 691 | 691 | && $this->has_dependents()) { |
| 692 | 692 | exception::has_dependants(); |
| 693 | 693 | return false; |