@@ -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 { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | { |
| 64 | 64 | $this->initialize(); |
| 65 | 65 | $properties = array_merge($this->cm->getFieldNames(), $this->cm->getAssociationNames(), array_keys($this->cm->midgard['field_aliases'])); |
| 66 | - $properties = array_filter($properties, function ($input) { |
|
| 66 | + $properties = array_filter($properties, function($input) { |
|
| 67 | 67 | return strpos($input, 'metadata_') === false; |
| 68 | 68 | }); |
| 69 | 69 | $ret = []; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | { |
| 79 | 79 | $this->initialize(); |
| 80 | 80 | |
| 81 | - if ( !$this->cm->hasField($field) |
|
| 81 | + if (!$this->cm->hasField($field) |
|
| 82 | 82 | && isset($field, $this->cm->midgard['field_aliases'][$field])) { |
| 83 | 83 | $field = $this->cm->midgard['field_aliases'][$field]; |
| 84 | 84 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | if (empty($value)) { |
| 89 | 89 | $value = null; |
| 90 | 90 | } else { |
| 91 | - if ( !\is_object($this->$field) |
|
| 91 | + if (!\is_object($this->$field) |
|
| 92 | 92 | || $this->$field->id != $value) { |
| 93 | 93 | $this->changed_associations[$field] = true; |
| 94 | 94 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } elseif ($this->cm->hasField($field)) { |
| 99 | 99 | $mapping = $this->cm->getFieldMapping($field); |
| 100 | 100 | |
| 101 | - if ( $mapping['type'] === 'string' |
|
| 101 | + if ($mapping['type'] === 'string' |
|
| 102 | 102 | || $mapping['type'] == 'text') { |
| 103 | 103 | $value = (string) $value; |
| 104 | 104 | } elseif ($mapping['type'] === 'integer') { |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } elseif ($mapping['type'] === 'float') { |
| 109 | 109 | $value = (float) $value; |
| 110 | 110 | } elseif ($mapping['type'] === 'midgard_datetime') { |
| 111 | - if ( \is_string($value) |
|
| 111 | + if (\is_string($value) |
|
| 112 | 112 | && $value !== '0000-00-00 00:00:00') { |
| 113 | 113 | $value = new midgard_datetime($value); |
| 114 | 114 | } elseif (!($value instanceof midgard_datetime)) { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $this->initialize(); |
| 126 | 126 | |
| 127 | - if ( !$this->cm->hasField($field) |
|
| 127 | + if (!$this->cm->hasField($field) |
|
| 128 | 128 | && array_key_exists($field, $this->cm->midgard['field_aliases'])) { |
| 129 | 129 | $field = $this->cm->midgard['field_aliases'][$field]; |
| 130 | 130 | } |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | return 0; |
| 139 | 139 | } |
| 140 | - if ( $this->$field === null |
|
| 140 | + if ($this->$field === null |
|
| 141 | 141 | && $this->cm->isIdentifier($field)) { |
| 142 | 142 | return 0; |
| 143 | 143 | } |
| 144 | - if ( $this->$field instanceof midgard_datetime |
|
| 144 | + if ($this->$field instanceof midgard_datetime |
|
| 145 | 145 | && $this->$field->format('U') == -62169984000) { |
| 146 | 146 | //This is mainly needed for working with converted Legacy databases. Midgard2 somehow handles this internally |
| 147 | 147 | //@todo Find a nicer solution and research how QB handles this |
@@ -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 | && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) { |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | $stat = $results > 0; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if ( !$stat |
|
| 399 | + if (!$stat |
|
| 400 | 400 | && !empty($this->cm->midgard['childtypes'])) { |
| 401 | 401 | foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { |
| 402 | 402 | $qb = connection::get_em()->createQueryBuilder(); |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | exception::not_exists(); |
| 756 | 756 | return false; |
| 757 | 757 | } |
| 758 | - if ( $check_dependencies |
|
| 758 | + if ($check_dependencies |
|
| 759 | 759 | && $this->has_dependents()) { |
| 760 | 760 | exception::has_dependants(); |
| 761 | 761 | return false; |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | } else { |
| 261 | 261 | $mrp = new \midgard_reflection_property($targetclass); |
| 262 | 262 | |
| 263 | - if ( !$mrp->is_link($part) |
|
| 263 | + if (!$mrp->is_link($part) |
|
| 264 | 264 | && !$mrp->is_special_link($part)) { |
| 265 | 265 | throw exception::ok(); |
| 266 | 266 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $column = $cm->midgard['field_aliases'][$column]; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if ( !$cm->hasField($column) |
|
| 280 | + if (!$cm->hasField($column) |
|
| 281 | 281 | && !$cm->hasAssociation($column)) { |
| 282 | 282 | throw exception::ok(); |
| 283 | 283 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | $expression = $operator . '( ?' . $this->parameters . ')'; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if ( $value === 0 |
|
| 301 | + if ($value === 0 |
|
| 302 | 302 | || $value === null |
| 303 | 303 | || is_array($value)) { |
| 304 | 304 | $cm = connection::get_em()->getClassMetadata($parsed['targetclass']); |