@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $this->initialize(); |
61 | 61 | $properties = array_merge($this->cm->getFieldNames(), $this->cm->getAssociationNames(), array_keys($this->cm->midgard['field_aliases'])); |
62 | - $properties = array_filter($properties, function ($input) { |
|
62 | + $properties = array_filter($properties, function($input) { |
|
63 | 63 | return strpos($input, 'metadata_') === false; |
64 | 64 | }); |
65 | 65 | $ret = []; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | $this->initialize(); |
76 | 76 | |
77 | - if ( !$this->cm->hasField($field) |
|
77 | + if (!$this->cm->hasField($field) |
|
78 | 78 | && isset($this->cm->midgard['field_aliases'][$field])) { |
79 | 79 | $field = $this->cm->midgard['field_aliases'][$field]; |
80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if (empty($value)) { |
85 | 85 | $value = null; |
86 | 86 | } else { |
87 | - if ( !\is_object($this->$field) |
|
87 | + if (!\is_object($this->$field) |
|
88 | 88 | || $this->$field->id != $value) { |
89 | 89 | $this->changed_associations[$field] = true; |
90 | 90 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | } elseif ($this->cm->hasField($field)) { |
95 | 95 | $mapping = $this->cm->getFieldMapping($field); |
96 | 96 | |
97 | - if ( $mapping['type'] === 'string' |
|
97 | + if ($mapping['type'] === 'string' |
|
98 | 98 | || $mapping['type'] == 'text') { |
99 | 99 | $value = (string) $value; |
100 | 100 | } elseif ($mapping['type'] === 'integer') { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } elseif ($mapping['type'] === 'float') { |
105 | 105 | $value = (float) $value; |
106 | 106 | } elseif ($mapping['type'] === 'datetime') { |
107 | - if ( \is_string($value) |
|
107 | + if (\is_string($value) |
|
108 | 108 | && $value !== '0000-00-00 00:00:00') { |
109 | 109 | $value = new midgard_datetime($value); |
110 | 110 | } elseif (!($value instanceof midgard_datetime)) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | $this->initialize(); |
122 | 122 | |
123 | - if ( !$this->cm->hasField($field) |
|
123 | + if (!$this->cm->hasField($field) |
|
124 | 124 | && isset($this->cm->midgard['field_aliases'][$field])) { |
125 | 125 | $field = $this->cm->midgard['field_aliases'][$field]; |
126 | 126 | } |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } |
134 | 134 | return 0; |
135 | 135 | } |
136 | - if ( $this->$field === null |
|
136 | + if ($this->$field === null |
|
137 | 137 | && $this->cm->isIdentifier($field)) { |
138 | 138 | return 0; |
139 | 139 | } |
140 | - if ( $this->$field instanceof midgard_datetime |
|
140 | + if ($this->$field instanceof midgard_datetime |
|
141 | 141 | && $this->$field->format('U') == -62169984000) { |
142 | 142 | //This is mainly needed for working with converted Legacy databases. Midgard2 somehow handles this internally |
143 | 143 | //@todo Find a nicer solution and research how QB handles this |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function load_by_properties(array $properties) |
66 | 66 | { |
67 | - if ( !array_key_exists('authtype', $properties) |
|
67 | + if (!array_key_exists('authtype', $properties) |
|
68 | 68 | || !array_key_exists('login', $properties)) { |
69 | 69 | throw exception::invalid_property_value(); |
70 | 70 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | public function &get_person() : person |
109 | 109 | { |
110 | - if ( $this->person_object === null |
|
110 | + if ($this->person_object === null |
|
111 | 111 | && $this->person !== null) { |
112 | 112 | $this->person_object = connection::get_em()->getRepository(connection::get_fqcn('midgard_person'))->findOneBy(['guid' => $this->person]); |
113 | 113 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | public function create() : bool |
118 | 118 | { |
119 | - if ( empty($this->authtype) |
|
119 | + if (empty($this->authtype) |
|
120 | 120 | || !empty($this->id)) { |
121 | 121 | exception::invalid_property_value(); |
122 | 122 | return false; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | |
181 | 181 | protected function is_unique() : bool |
182 | 182 | { |
183 | - if ( empty($this->login) |
|
183 | + if (empty($this->login) |
|
184 | 184 | || empty($this->authtype)) { |
185 | 185 | return true; |
186 | 186 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | $cs = $em->getUnitOfWork()->getEntityChangeSet($entity); |
108 | 108 | // We only need to update repligard if we're coming from create (revision 0) |
109 | 109 | // or if we delete/undelete |
110 | - if ( !array_key_exists('metadata_deleted', $cs) |
|
111 | - && $entity->metadata_revision > 0) { |
|
110 | + if (!array_key_exists('metadata_deleted', $cs) |
|
111 | + && $entity->metadata_revision > 0) { |
|
112 | 112 | $check_repligard = false; |
113 | 113 | } |
114 | 114 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | foreach ($columns as $name => &$config) { |
179 | 179 | if ($platform instanceof SqlitePlatform) { |
180 | - if ( !empty($config['comment']) |
|
180 | + if (!empty($config['comment']) |
|
181 | 181 | && $config['comment'] == 'BINARY') { |
182 | 182 | $modified = true; |
183 | 183 | $config['columnDefinition'] = $config['type']->getSQLDeclaration($config, $platform) . ' COLLATE BINARY' . $platform->getDefaultValueDeclarationSQL($config); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | $config['columnDefinition'] = $config['comment'] . $platform->getDefaultValueDeclarationSQL($config); |
195 | 195 | } |
196 | 196 | if (!empty($config['columnDefinition']) && $platform->supportsInlineColumnComments()) { |
197 | - $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
197 | + $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
198 | 198 | } |
199 | 199 | } |
200 | 200 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $args) |
279 | 279 | { |
280 | 280 | $table = $args->getClassTable(); |
281 | - if ( !$table->hasOption('engine') |
|
281 | + if (!$table->hasOption('engine') |
|
282 | 282 | || $table->getOption('engine') !== 'MyISAM') { |
283 | 283 | return; |
284 | 284 | } |
@@ -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; |