@@ -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, |
@@ -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 |