@@ -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($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 | && isset($this->cm->midgard['field_aliases'][$field])) { |
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 |
@@ -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); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | foreach ($candidates as $candidate) { |
101 | 101 | if ($this->$candidate !== null) { |
102 | 102 | //Proxies become stale if the object itself is detached, so we have to re-fetch |
103 | - if ( $this->$candidate instanceof Proxy |
|
103 | + if ($this->$candidate instanceof Proxy |
|
104 | 104 | && $this->$candidate->__isInitialized()) { |
105 | 105 | try { |
106 | 106 | $this->$candidate->get_by_id($this->$candidate->id); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | // According to Doctrine documentation, proxies should be transparent, but in practice, |
130 | 130 | // there will be problems if we don't force-load |
131 | - if ( $entity instanceof Proxy |
|
131 | + if ($entity instanceof Proxy |
|
132 | 132 | && !$entity->__isInitialized()) { |
133 | 133 | try { |
134 | 134 | $entity->__load(); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | exception::duplicate(); |
182 | 182 | return false; |
183 | 183 | } |
184 | - if ( !$this->is_unique() |
|
184 | + if (!$this->is_unique() |
|
185 | 185 | || !$this->check_parent()) { |
186 | 186 | return false; |
187 | 187 | } |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | midgard_connection::get_instance()->set_error(MGD_ERR_INVALID_PROPERTY_VALUE); |
238 | 238 | return false; |
239 | 239 | } |
240 | - if ( $check_dependencies |
|
240 | + if ($check_dependencies |
|
241 | 241 | && $this->has_dependents()) { |
242 | 242 | exception::has_dependants(); |
243 | 243 | return false; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | { |
329 | 329 | $this->initialize(); |
330 | 330 | |
331 | - if ( empty($this->cm->midgard['parentfield']) |
|
331 | + if (empty($this->cm->midgard['parentfield']) |
|
332 | 332 | || empty($this->cm->midgard['parent'])) { |
333 | 333 | return true; |
334 | 334 | } |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | $this->initialize(); |
346 | 346 | |
347 | 347 | foreach ($this->cm->fieldMappings as $name => $field) { |
348 | - if ( $field['midgard:midgard_type'] == translator::TYPE_GUID |
|
348 | + if ($field['midgard:midgard_type'] == translator::TYPE_GUID |
|
349 | 349 | && !empty($this->$name) |
350 | 350 | && !mgd_is_guid($this->$name)) { |
351 | 351 | exception::invalid_property_value("'" . $name . "' property's value is not a guid."); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | |
358 | 358 | private function check_upfield() : bool |
359 | 359 | { |
360 | - if ( !empty($this->id) |
|
360 | + if (!empty($this->id) |
|
361 | 361 | && !empty($this->cm->midgard['upfield']) |
362 | 362 | && $this->__get($this->cm->midgard['upfield']) === $this->id |
363 | 363 | && $this->cm->getAssociationMapping($this->cm->midgard['upfield'])['targetEntity'] === $this->cm->getName()) { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | $stat = $results > 0; |
395 | 395 | } |
396 | 396 | |
397 | - if ( !$stat |
|
397 | + if (!$stat |
|
398 | 398 | && !empty($this->cm->midgard['childtypes'])) { |
399 | 399 | foreach ($this->cm->midgard['childtypes'] as $typename => $parentfield) { |
400 | 400 | $qb = connection::get_em()->createQueryBuilder(); |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | exception::not_exists(); |
744 | 744 | return false; |
745 | 745 | } |
746 | - if ( $check_dependencies |
|
746 | + if ($check_dependencies |
|
747 | 747 | && $this->has_dependents()) { |
748 | 748 | exception::has_dependants(); |
749 | 749 | return false; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | private function load_by_properties(array $properties) |
55 | 55 | { |
56 | - if ( !array_key_exists('authtype', $properties) |
|
56 | + if (!array_key_exists('authtype', $properties) |
|
57 | 57 | || !array_key_exists('login', $properties)) { |
58 | 58 | throw exception::invalid_property_value(); |
59 | 59 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | public function &get_person() : person |
98 | 98 | { |
99 | - if ( $this->person_object === null |
|
99 | + if ($this->person_object === null |
|
100 | 100 | && $this->person !== null) { |
101 | 101 | $this->person_object = connection::get_em()->getRepository('midgard:midgard_person')->findOneBy(['guid' => $this->person]); |
102 | 102 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | public function create() : bool |
107 | 107 | { |
108 | - if ( empty($this->authtype) |
|
108 | + if (empty($this->authtype) |
|
109 | 109 | || !empty($this->id)) { |
110 | 110 | exception::invalid_property_value(); |
111 | 111 | return false; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | protected function is_unique() : bool |
171 | 171 | { |
172 | - if ( empty($this->login) |
|
172 | + if (empty($this->login) |
|
173 | 173 | || empty($this->authtype)) { |
174 | 174 | return true; |
175 | 175 | } |
@@ -123,7 +123,7 @@ |
||
123 | 123 | $subdirs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F']; |
124 | 124 | foreach ($subdirs as $dir) { |
125 | 125 | foreach ($subdirs as $subdir) { |
126 | - if ( !is_dir($this->blobdir . '/' . $dir . '/' . $subdir) |
|
126 | + if (!is_dir($this->blobdir . '/' . $dir . '/' . $subdir) |
|
127 | 127 | && !mkdir($this->blobdir . '/' . $dir . '/' . $subdir, 0777, true)) { |
128 | 128 | return false; |
129 | 129 | } |
@@ -152,7 +152,7 @@ |
||
152 | 152 | |
153 | 153 | foreach ($properties as $name => $property) { |
154 | 154 | // doctrine can handle id links only |
155 | - if ( $property->link |
|
155 | + if ($property->link |
|
156 | 156 | && $target_class = $this->manager->resolve_targetclass($property)) { |
157 | 157 | $link_mapping = [ |
158 | 158 | 'fieldName' => $property->name, |