@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $value = (array) $value; |
105 | 105 | $value = array_merge($value, $this->get_child_ids($mapping['targetEntity'], $parentfield, $value)); |
106 | - } elseif ( $operator === 'IN' |
|
106 | + } elseif ($operator === 'IN' |
|
107 | 107 | || $operator === 'NOT IN') { |
108 | 108 | $value = array_values($value); |
109 | 109 | } elseif (!in_array($operator, ['=', '>', '<', '<>', '<=', '>=', 'LIKE', 'NOT LIKE'])) { |
@@ -257,14 +257,14 @@ discard block |
||
257 | 257 | $parts = explode('.', $name); |
258 | 258 | $column = array_pop($parts); |
259 | 259 | foreach ($parts as $part) { |
260 | - if ( $part === 'parameter' |
|
260 | + if ($part === 'parameter' |
|
261 | 261 | || $part === 'attachment') { |
262 | 262 | $targetclass = 'midgard_' . $part; |
263 | 263 | $current_table = $this->add_collection_join($current_table, $targetclass); |
264 | 264 | } else { |
265 | 265 | $mrp = new \midgard_reflection_property($targetclass); |
266 | 266 | |
267 | - if ( !$mrp->is_link($part) |
|
267 | + if (!$mrp->is_link($part) |
|
268 | 268 | && !$mrp->is_special_link($part)) { |
269 | 269 | throw exception::ok(); |
270 | 270 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $column = $cm->midgard['field_aliases'][$column]; |
282 | 282 | } |
283 | 283 | |
284 | - if ( !$cm->hasField($column) |
|
284 | + if (!$cm->hasField($column) |
|
285 | 285 | && !$cm->hasAssociation($column)) { |
286 | 286 | throw exception::ok(); |
287 | 287 | } |
@@ -298,12 +298,12 @@ discard block |
||
298 | 298 | $parsed = $this->parse_constraint_name($name); |
299 | 299 | $expression = $operator . ' ?' . $this->parameters; |
300 | 300 | |
301 | - if ( $operator === 'IN' |
|
301 | + if ($operator === 'IN' |
|
302 | 302 | || $operator === 'NOT IN') { |
303 | 303 | $expression = $operator . '( ?' . $this->parameters . ')'; |
304 | 304 | } |
305 | 305 | |
306 | - if ( $value === 0 |
|
306 | + if ($value === 0 |
|
307 | 307 | || $value === null |
308 | 308 | || is_array($value)) { |
309 | 309 | $cm = connection::get_em()->getClassMetadata($parsed['targetclass']); |
@@ -201,19 +201,19 @@ |
||
201 | 201 | break; |
202 | 202 | } |
203 | 203 | |
204 | - if ( $dbobject->id > 0 |
|
204 | + if ($dbobject->id > 0 |
|
205 | 205 | && $dbobject->metadata->revised->format('U') >= $object->metadata->revised->format('U')) { |
206 | 206 | midgard_connection::get_instance()->set_error(exception::OBJECT_IMPORTED); |
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | |
210 | - if ( $dbobject->metadata->deleted |
|
210 | + if ($dbobject->metadata->deleted |
|
211 | 211 | && !$object->metadata->deleted) { |
212 | 212 | if (!midgard_object_class::undelete($dbobject->guid)) { |
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | $dbobject->metadata_deleted = false; |
216 | - } elseif ( !$dbobject->metadata->deleted |
|
216 | + } elseif (!$dbobject->metadata->deleted |
|
217 | 217 | && $object->metadata->deleted) { |
218 | 218 | return $dbobject->delete(); |
219 | 219 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if (!($entity instanceof repligard)) { |
100 | 100 | $repligard_entry = $em->getRepository('midgard:midgard_repligard')->findOneBy(['guid' => $entity->guid]); |
101 | 101 | |
102 | - if ( $entity instanceof metadata |
|
102 | + if ($entity instanceof metadata |
|
103 | 103 | && $entity->{metadata::DELETED_FIELD}) { |
104 | 104 | $repligard_entry->object_action = self::ACTION_DELETE; |
105 | 105 | } else { |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | foreach ($columns as $name => &$config) { |
142 | 142 | if ($platform->getName() === 'sqlite') { |
143 | - if ( !empty($config['primary']) |
|
143 | + if (!empty($config['primary']) |
|
144 | 144 | && !empty($config['autoincrement'])) { |
145 | 145 | /* |
146 | 146 | * This is essentially a workaround for http://www.doctrine-project.org/jira/browse/DBAL-642 |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $modified = true; |
150 | 150 | $config['columnDefinition'] = 'INTEGER PRIMARY KEY AUTOINCREMENT'; |
151 | 151 | } |
152 | - if ( !empty($config['comment']) |
|
152 | + if (!empty($config['comment']) |
|
153 | 153 | && $config['comment'] == 'BINARY') { |
154 | 154 | $modified = true; |
155 | 155 | $config['columnDefinition'] = $config['type']->getSQLDeclaration($config, $platform) . ' COLLATE BINARY' . $platform->getDefaultValueDeclarationSQL($config); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | $config['columnDefinition'] = $config['comment'] . $platform->getDefaultValueDeclarationSQL($config); |
167 | 167 | } |
168 | 168 | if (!empty($config['columnDefinition']) && $platform->supportsInlineColumnComments()) { |
169 | - $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
169 | + $config['columnDefinition'] .= " COMMENT " . $platform->quoteStringLiteral($config['comment']); |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function postGenerateSchemaTable(GenerateSchemaTableEventArgs $args) |
261 | 261 | { |
262 | 262 | $table = $args->getClassTable(); |
263 | - if ( !$table->hasOption('engine') |
|
263 | + if (!$table->hasOption('engine') |
|
264 | 264 | || $table->getOption('engine') !== 'MyISAM') { |
265 | 265 | return; |
266 | 266 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | |
76 | 76 | $fqcn = $this->get_fcqn($property->link['target']); |
77 | 77 | |
78 | - if ( array_key_exists($fqcn, $this->types) |
|
78 | + if (array_key_exists($fqcn, $this->types) |
|
79 | 79 | || $property->link['target'] === $property->get_parent()->name) { |
80 | 80 | $target_class = $property->link['target']; |
81 | 81 | } else { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | public function __get($field) |
82 | 82 | { |
83 | - if ( $field === 'metadata' |
|
83 | + if ($field === 'metadata' |
|
84 | 84 | && $this->metadata === null |
85 | 85 | && $this instanceof metadata_interface) { |
86 | 86 | $this->metadata = new metadata($this); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | foreach ($candidates as $candidate) { |
103 | 103 | if ($this->$candidate !== null) { |
104 | 104 | //Proxies become stale if the object itself is detached, so we have to re-fetch |
105 | - if ( $this->$candidate instanceof Proxy |
|
105 | + if ($this->$candidate instanceof Proxy |
|
106 | 106 | && $this->$candidate->__isInitialized()) { |
107 | 107 | try { |
108 | 108 | $this->$candidate->get_by_id($this->$candidate->id); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | // According to Doctrine documentation, proxies should be transparent, but in practice, |
132 | 132 | // there will be problems if we don't force-load |
133 | - if ( $entity instanceof Proxy |
|
133 | + if ($entity instanceof Proxy |
|
134 | 134 | && !$entity->__isInitialized()) { |
135 | 135 | try { |
136 | 136 | $entity->__load(); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | exception::duplicate(); |
184 | 184 | return false; |
185 | 185 | } |
186 | - if ( !$this->is_unique() |
|
186 | + if (!$this->is_unique() |
|
187 | 187 | || !$this->check_parent()) { |
188 | 188 | return false; |
189 | 189 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | midgard_connection::get_instance()->set_error(MGD_ERR_INVALID_PROPERTY_VALUE); |
240 | 240 | return false; |
241 | 241 | } |
242 | - if ( $check_dependencies |
|
242 | + if ($check_dependencies |
|
243 | 243 | && $this->has_dependents()) { |
244 | 244 | exception::has_dependants(); |
245 | 245 | return false; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | { |
331 | 331 | $this->initialize(); |
332 | 332 | |
333 | - if ( empty($this->cm->midgard['parentfield']) |
|
333 | + if (empty($this->cm->midgard['parentfield']) |
|
334 | 334 | || empty($this->cm->midgard['parent'])) { |
335 | 335 | return true; |
336 | 336 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $this->initialize(); |
348 | 348 | |
349 | 349 | foreach ($this->cm->fieldMappings as $name => $field) { |
350 | - if ( $field['midgard:midgard_type'] == translator::TYPE_GUID |
|
350 | + if ($field['midgard:midgard_type'] == translator::TYPE_GUID |
|
351 | 351 | && !empty($this->$name) |
352 | 352 | && !mgd_is_guid($this->$name)) { |
353 | 353 | exception::invalid_property_value("'" . $name . "' property's value is not a guid."); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | private function check_upfield() |
361 | 361 | { |
362 | - if ( !empty($this->id) |
|
362 | + if (!empty($this->id) |
|
363 | 363 | && !empty($this->cm->midgard['upfield']) |
364 | 364 | && $this->__get($this->cm->midgard['upfield']) === $this->id) { |
365 | 365 | exception::tree_is_circular(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $stat = ($results > 0); |
396 | 396 | } |
397 | 397 | |
398 | - if ( !$stat |
|
398 | + if (!$stat |
|
399 | 399 | && !empty($this->cm->midgard['childtypes'])) { |
400 | 400 | foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { |
401 | 401 | $qb = connection::get_em()->createQueryBuilder(); |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | exception::not_exists(); |
755 | 755 | return false; |
756 | 756 | } |
757 | - if ( $check_dependencies |
|
757 | + if ($check_dependencies |
|
758 | 758 | && $this->has_dependents()) { |
759 | 759 | exception::has_dependants(); |
760 | 760 | return false; |