@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $this->initialize(); |
| 58 | 58 | $properties = array_merge($this->cm->getFieldNames(), $this->cm->getAssociationNames(), array_keys($this->cm->midgard['field_aliases'])); |
| 59 | - $properties = array_filter($properties, function ($input) { |
|
| 59 | + $properties = array_filter($properties, function($input) { |
|
| 60 | 60 | return !str_contains($input, 'metadata_'); |
| 61 | 61 | }); |
| 62 | 62 | $ret = []; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $this->initialize(); |
| 73 | 73 | |
| 74 | - if ( !$this->cm->hasField($field) |
|
| 74 | + if (!$this->cm->hasField($field) |
|
| 75 | 75 | && isset($this->cm->midgard['field_aliases'][$field])) { |
| 76 | 76 | $field = $this->cm->midgard['field_aliases'][$field]; |
| 77 | 77 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if (empty($value)) { |
| 82 | 82 | $value = null; |
| 83 | 83 | } else { |
| 84 | - if ( !\is_object($this->$field) |
|
| 84 | + if (!\is_object($this->$field) |
|
| 85 | 85 | || $this->$field->id != $value) { |
| 86 | 86 | $this->changed_associations[$field] = true; |
| 87 | 87 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } elseif ($this->cm->hasField($field)) { |
| 92 | 92 | $mapping = $this->cm->getFieldMapping($field); |
| 93 | 93 | |
| 94 | - if ( $mapping['type'] === 'string' |
|
| 94 | + if ($mapping['type'] === 'string' |
|
| 95 | 95 | || $mapping['type'] == 'text') { |
| 96 | 96 | $value = (string) $value; |
| 97 | 97 | } elseif ($mapping['type'] === 'integer') { |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } elseif ($mapping['type'] === 'float') { |
| 102 | 102 | $value = (float) $value; |
| 103 | 103 | } elseif (in_array($mapping['type'], ['datetime', 'date'])) { |
| 104 | - if ( \is_string($value) |
|
| 104 | + if (\is_string($value) |
|
| 105 | 105 | && $value !== '0000-00-00 00:00:00') { |
| 106 | 106 | $value = new midgard_datetime($value); |
| 107 | 107 | } elseif (!($value instanceof midgard_datetime)) { |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $this->initialize(); |
| 119 | 119 | |
| 120 | - if ( !$this->cm->hasField($field) |
|
| 120 | + if (!$this->cm->hasField($field) |
|
| 121 | 121 | && isset($this->cm->midgard['field_aliases'][$field])) { |
| 122 | 122 | $field = $this->cm->midgard['field_aliases'][$field]; |
| 123 | 123 | } |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | return 0; |
| 132 | 132 | } |
| 133 | - if ( $this->$field === null |
|
| 133 | + if ($this->$field === null |
|
| 134 | 134 | && $this->cm->isIdentifier($field)) { |
| 135 | 135 | return 0; |
| 136 | 136 | } |
| 137 | - if ( $this->$field instanceof midgard_datetime |
|
| 137 | + if ($this->$field instanceof midgard_datetime |
|
| 138 | 138 | && $this->$field->format('U') == -62169984000) { |
| 139 | 139 | //This is mainly needed for working with converted Legacy databases. Midgard2 somehow handles this internally |
| 140 | 140 | //@todo Find a nicer solution and research how QB handles this |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $parsed = $this->parse_constraint_name($property); |
| 60 | 60 | |
| 61 | 61 | // for properties like up.name |
| 62 | - if ( str_contains($property, ".") |
|
| 62 | + if (str_contains($property, ".") |
|
| 63 | 63 | && !(str_starts_with($property, "metadata"))) { |
| 64 | 64 | return $parsed['name'] . " as " . str_replace(".", "_", $property); |
| 65 | 65 | } |