@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if (null === $url) { |
113 | 113 | $script = '<script type="text/javascript">'; |
114 | 114 | if (isset($message)) { |
115 | - $script .= 'alert("' . bab_toHtml($message, BAB_HTML_JS) . '");'; |
|
115 | + $script .= 'alert("'.bab_toHtml($message, BAB_HTML_JS).'");'; |
|
116 | 116 | } |
117 | 117 | $script .= 'history.back();'; |
118 | 118 | $script .= '</script>'; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $url = $url->url(); |
125 | 125 | } |
126 | 126 | if (!empty($babBody->msgerror)) { |
127 | - $url .= '&msgerror=' . urlencode($babBody->msgerror); |
|
127 | + $url .= '&msgerror='.urlencode($babBody->msgerror); |
|
128 | 128 | } |
129 | 129 | if (isset($message)) { |
130 | 130 | $lines = explode("\n", $message); |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | - header('Location: ' . $url); |
|
136 | + header('Location: '.$url); |
|
137 | 137 | die; |
138 | 138 | } |
139 | 139 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function app_fileUploadError($error) |
167 | 167 | { |
168 | - switch($error) { |
|
168 | + switch ($error) { |
|
169 | 169 | case UPLOAD_ERR_OK: |
170 | 170 | return null; |
171 | 171 |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * @copyright Copyright (c) 2006 by CANTICO ({@link http://www.cantico.fr}) |
22 | 22 | */ |
23 | 23 | |
24 | -define('APP_PHP_PATH', dirname(__FILE__) . '/'); |
|
25 | -define('APP_SET_PATH', dirname(__FILE__) . '/'); |
|
26 | -define('APP_UI_PATH', dirname(__FILE__) . '/ui/'); |
|
27 | -define('APP_WIDGETS_PATH', APP_UI_PATH . 'widgets/'); |
|
28 | -define('APP_CTRL_PATH', dirname(__FILE__) . '/'); |
|
29 | -define('APP_PORTLET_PATH', APP_PHP_PATH . 'portlet/'); |
|
30 | 24 | \ No newline at end of file |
25 | +define('APP_PHP_PATH', dirname(__FILE__).'/'); |
|
26 | +define('APP_SET_PATH', dirname(__FILE__).'/'); |
|
27 | +define('APP_UI_PATH', dirname(__FILE__).'/ui/'); |
|
28 | +define('APP_WIDGETS_PATH', APP_UI_PATH.'widgets/'); |
|
29 | +define('APP_CTRL_PATH', dirname(__FILE__).'/'); |
|
30 | +define('APP_PORTLET_PATH', APP_PHP_PATH.'portlet/'); |
|
31 | 31 | \ No newline at end of file |
@@ -109,9 +109,9 @@ |
||
109 | 109 | public function isUpdatable() |
110 | 110 | { |
111 | 111 | return $this->all(); |
112 | - if($this->App() |
|
112 | + if ($this->App() |
|
113 | 113 | ->Access() |
114 | - ->administer()){ |
|
114 | + ->administer()) { |
|
115 | 115 | return $this->all(); |
116 | 116 | } |
117 | 117 | return $this->none(); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $App = app_App(); |
64 | 64 | static $fieldsLayouts = null; |
65 | 65 | |
66 | - if(! isset($fieldsLayouts)){ |
|
66 | + if (!isset($fieldsLayouts)) { |
|
67 | 67 | $fieldsLayouts = array( |
68 | 68 | self::FIELDS_LAYOUT_VERTICAL_LABEL => $App->translate('Vertical label'), |
69 | 69 | self::FIELDS_LAYOUT_HORIZONTAL_LABEL => $App->translate('Horizontal label'), |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getRawFields() |
82 | 82 | { |
83 | - if(empty($this->fields)){ |
|
83 | + if (empty($this->fields)) { |
|
84 | 84 | return array(); |
85 | 85 | } |
86 | 86 | return explode(',', $this->fields); |
@@ -105,29 +105,29 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function getFields() |
107 | 107 | { |
108 | - if(empty($this->fields)){ |
|
108 | + if (empty($this->fields)) { |
|
109 | 109 | return array(); |
110 | 110 | } |
111 | 111 | $fields = json_decode($this->fields, true); |
112 | - if(json_last_error() === JSON_ERROR_NONE){ |
|
112 | + if (json_last_error() === JSON_ERROR_NONE) { |
|
113 | 113 | return $fields; |
114 | 114 | } |
115 | 115 | |
116 | 116 | $fields = array(); |
117 | 117 | $rawFields = $this->getRawFields(); |
118 | - foreach ($rawFields as $rawField){ |
|
119 | - if(empty($rawField)){ |
|
118 | + foreach ($rawFields as $rawField) { |
|
119 | + if (empty($rawField)) { |
|
120 | 120 | continue; |
121 | 121 | } |
122 | 122 | $params = array(); |
123 | 123 | |
124 | - if(strpos($rawField, ':') === false){ |
|
124 | + if (strpos($rawField, ':') === false) { |
|
125 | 125 | $fieldName = $rawField; |
126 | 126 | } |
127 | - else{ |
|
127 | + else { |
|
128 | 128 | list ($fieldName, $parameters) = explode(':', $rawField); |
129 | 129 | $parameters = explode(';', $parameters); |
130 | - foreach ($parameters as $parameter){ |
|
130 | + foreach ($parameters as $parameter) { |
|
131 | 131 | list ($key, $value) = explode('=', $parameter); |
132 | 132 | $params[$key] = $value; |
133 | 133 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function getField($searchedFieldName) |
162 | 162 | { |
163 | - if(empty($this->fields)){ |
|
163 | + if (empty($this->fields)) { |
|
164 | 164 | return null; |
165 | 165 | } |
166 | 166 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function addField($fieldName, $parameters = null) |
178 | 178 | { |
179 | 179 | $fields = $this->getFields(); |
180 | - if(! isset($parameters)){ |
|
180 | + if (!isset($parameters)) { |
|
181 | 181 | $fields[$fieldName] = array( |
182 | 182 | 'block' => '' |
183 | 183 | ); |
@@ -211,24 +211,24 @@ discard block |
||
211 | 211 | { |
212 | 212 | $isFieldsGroup = false; |
213 | 213 | $fields = $this->getFields(); |
214 | - if(strpos($updatedFieldName, '_fieldsGroup') !== false){ |
|
214 | + if (strpos($updatedFieldName, '_fieldsGroup') !== false) { |
|
215 | 215 | $isFieldsGroup = true; |
216 | 216 | list (, $groupPos) = explode('_fieldsGroup', $updatedFieldName); |
217 | - if(! isset($groupPos) || empty($groupPos)){ |
|
217 | + if (!isset($groupPos) || empty($groupPos)) { |
|
218 | 218 | $groupPos = 0; |
219 | 219 | } |
220 | 220 | } |
221 | - if(! isset($fields[$updatedFieldName])){ |
|
222 | - if($isFieldsGroup){ |
|
223 | - while (isset($fields[$updatedFieldName . $groupPos])){ |
|
224 | - $groupPos ++; |
|
221 | + if (!isset($fields[$updatedFieldName])) { |
|
222 | + if ($isFieldsGroup) { |
|
223 | + while (isset($fields[$updatedFieldName.$groupPos])) { |
|
224 | + $groupPos++; |
|
225 | 225 | } |
226 | 226 | $updatedFieldName .= $groupPos; |
227 | 227 | } |
228 | 228 | $this->addField($updatedFieldName, $parameters); |
229 | 229 | return $this; |
230 | 230 | } |
231 | - if(! isset($parameters)){ |
|
231 | + if (!isset($parameters)) { |
|
232 | 232 | $fields[$updatedFieldName] = array( |
233 | 233 | 'block' => '' |
234 | 234 | ); |
@@ -243,11 +243,11 @@ discard block |
||
243 | 243 | public function addFieldToGroup($fieldGroupName, $fieldName, $parameters = null) |
244 | 244 | { |
245 | 245 | $fields = $this->getFields(); |
246 | - if(! isset($fields[$fieldGroupName])){ |
|
246 | + if (!isset($fields[$fieldGroupName])) { |
|
247 | 247 | return $this; |
248 | 248 | } |
249 | 249 | $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array(); |
250 | - if(! isset($parameters)){ |
|
250 | + if (!isset($parameters)) { |
|
251 | 251 | $groupFields[$fieldName] = array( |
252 | 252 | 'block' => '' |
253 | 253 | ); |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | public function updateFieldGroup($fieldGroupName, $updatedFieldName, $parameters = null) |
282 | 282 | { |
283 | 283 | $fields = $this->getFields(); |
284 | - if(! isset($fields[$fieldGroupName])){ |
|
284 | + if (!isset($fields[$fieldGroupName])) { |
|
285 | 285 | return $this; |
286 | 286 | } |
287 | 287 | $groupFields = isset($fields[$fieldGroupName]['fields']) ? $fields[$fieldGroupName]['fields'] : array(); |
288 | - if(! isset($groupFields[$updatedFieldName])){ |
|
288 | + if (!isset($groupFields[$updatedFieldName])) { |
|
289 | 289 | $this->addFieldToGroup($fieldGroupName, $updatedFieldName, $parameters); |
290 | 290 | return $this; |
291 | 291 | } |
292 | - if(! isset($parameters)){ |
|
292 | + if (!isset($parameters)) { |
|
293 | 293 | $groupFields[$updatedFieldName] = array( |
294 | 294 | 'block' => '' |
295 | 295 | ); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | */ |
310 | 310 | public function isVisibleForRecord(AppRecord $record) |
311 | 311 | { |
312 | - if(empty($this->visibilityCriteria)){ |
|
312 | + if (empty($this->visibilityCriteria)) { |
|
313 | 313 | return true; |
314 | 314 | } |
315 | 315 | |
@@ -318,36 +318,36 @@ discard block |
||
318 | 318 | |
319 | 319 | $arrCriteria = json_decode($this->visibilityCriteria, true); |
320 | 320 | |
321 | - foreach ($arrCriteria as $fieldName => $condition){ |
|
322 | - if(strpos($fieldName, '/') !== false){ |
|
321 | + foreach ($arrCriteria as $fieldName => $condition) { |
|
322 | + if (strpos($fieldName, '/') !== false) { |
|
323 | 323 | list ($oneField, $foreignField) = explode('/', $fieldName); |
324 | 324 | $field = $recordSet->$oneField()->$foreignField; |
325 | 325 | } |
326 | - else{ |
|
326 | + else { |
|
327 | 327 | $field = $recordSet->$fieldName; |
328 | 328 | } |
329 | - foreach ($condition as $op => $value){ |
|
330 | - if(! is_array($value)){ |
|
329 | + foreach ($condition as $op => $value) { |
|
330 | + if (!is_array($value)) { |
|
331 | 331 | $criteria = $field->$op($value); |
332 | 332 | } |
333 | - else{ |
|
334 | - foreach ($value as $foreignClassName => $foreignValues){ |
|
335 | - $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set'; |
|
333 | + else { |
|
334 | + foreach ($value as $foreignClassName => $foreignValues) { |
|
335 | + $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName).'Set'; |
|
336 | 336 | $foreignSet = $App->$foreignClassName(); |
337 | 337 | $foreignField = ''; |
338 | 338 | $foreignCondition = ''; |
339 | - foreach ($foreignValues as $foreignFieldName => $foreignConditions){ |
|
340 | - if($foreignFieldName === '_foreignField'){ |
|
339 | + foreach ($foreignValues as $foreignFieldName => $foreignConditions) { |
|
340 | + if ($foreignFieldName === '_foreignField') { |
|
341 | 341 | $foreignField = $foreignConditions; |
342 | 342 | } |
343 | - else{ |
|
344 | - foreach ($foreignConditions as $key => $val){ |
|
343 | + else { |
|
344 | + foreach ($foreignConditions as $key => $val) { |
|
345 | 345 | $foreignCondition = $foreignSet->$foreignFieldName->$key($val); |
346 | 346 | } |
347 | 347 | } |
348 | 348 | } |
349 | 349 | } |
350 | - if(method_exists($foreignSet, 'getDefaultCriteria')){ |
|
350 | + if (method_exists($foreignSet, 'getDefaultCriteria')) { |
|
351 | 351 | $foreignCondition = $foreignCondition->_AND_($foreignSet->getDefaultCriteria()); |
352 | 352 | } |
353 | 353 | $criteria = $field->in($foreignCondition, $foreignField); |
@@ -123,8 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | if(strpos($rawField, ':') === false){ |
125 | 125 | $fieldName = $rawField; |
126 | - } |
|
127 | - else{ |
|
126 | + } else{ |
|
128 | 127 | list ($fieldName, $parameters) = explode(':', $rawField); |
129 | 128 | $parameters = explode(';', $parameters); |
130 | 129 | foreach ($parameters as $parameter){ |
@@ -322,15 +321,13 @@ discard block |
||
322 | 321 | if(strpos($fieldName, '/') !== false){ |
323 | 322 | list ($oneField, $foreignField) = explode('/', $fieldName); |
324 | 323 | $field = $recordSet->$oneField()->$foreignField; |
325 | - } |
|
326 | - else{ |
|
324 | + } else{ |
|
327 | 325 | $field = $recordSet->$fieldName; |
328 | 326 | } |
329 | 327 | foreach ($condition as $op => $value){ |
330 | 328 | if(! is_array($value)){ |
331 | 329 | $criteria = $field->$op($value); |
332 | - } |
|
333 | - else{ |
|
330 | + } else{ |
|
334 | 331 | foreach ($value as $foreignClassName => $foreignValues){ |
335 | 332 | $foreignClassName = str_replace($App->classPrefix, '', $foreignClassName) . 'Set'; |
336 | 333 | $foreignSet = $App->$foreignClassName(); |
@@ -339,8 +336,7 @@ discard block |
||
339 | 336 | foreach ($foreignValues as $foreignFieldName => $foreignConditions){ |
340 | 337 | if($foreignFieldName === '_foreignField'){ |
341 | 338 | $foreignField = $foreignConditions; |
342 | - } |
|
343 | - else{ |
|
339 | + } else{ |
|
344 | 340 | foreach ($foreignConditions as $key => $val){ |
345 | 341 | $foreignCondition = $foreignSet->$foreignFieldName->$key($val); |
346 | 342 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | public function selectUserSSE($user = null) |
62 | 62 | { |
63 | - if(!isset($user)){ |
|
63 | + if (!isset($user)) { |
|
64 | 64 | $App = $this->App(); |
65 | 65 | $user = $App->getCurrentUser(); |
66 | 66 | } |
@@ -82,29 +82,29 @@ discard block |
||
82 | 82 | $userSSEReloads = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_RELOAD_SELECTOR))); |
83 | 83 | $reloadSelectors = array(); |
84 | 84 | $now = date('Y-m-d H:i:s'); |
85 | - foreach ($userSSEReloads as $sseMsg){ |
|
85 | + foreach ($userSSEReloads as $sseMsg) { |
|
86 | 86 | $reloadSelectors[] = $sseMsg->data; |
87 | - if($delete && $now > date($sseMsg->deleteOn)){ |
|
87 | + if ($delete && $now > date($sseMsg->deleteOn)) { |
|
88 | 88 | $sseMsg->delete(); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if(!empty($reloadSelectors)){ |
|
92 | + if (!empty($reloadSelectors)) { |
|
93 | 93 | $sseData .= '"reloadSelector":'.bab_json_encode($reloadSelectors); |
94 | 94 | $hasData = true; |
95 | 95 | } |
96 | 96 | |
97 | 97 | $userSSEBrowserNotifications = $this->select($this->user->is($user)->_AND_($this->type->is(AppSSE::TYPE_BROWSER_NOTIFICATION))); |
98 | 98 | $browserNotifications = array(); |
99 | - foreach ($userSSEBrowserNotifications as $sseMsg){ |
|
99 | + foreach ($userSSEBrowserNotifications as $sseMsg) { |
|
100 | 100 | $browserNotifications[] = $sseMsg->data; |
101 | - if($delete){ |
|
101 | + if ($delete) { |
|
102 | 102 | $sseMsg->delete(); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | - if(!empty($browserNotifications)){ |
|
107 | - if($hasData){ |
|
106 | + if (!empty($browserNotifications)) { |
|
107 | + if ($hasData) { |
|
108 | 108 | $sseData .= ', '; |
109 | 109 | } |
110 | 110 | $sseData .= '"browserNotifications":'.bab_json_encode($browserNotifications); |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | { |
126 | 126 | $App = $this->App(); |
127 | 127 | $users = array(); |
128 | - if(!isset($for)){ |
|
128 | + if (!isset($for)) { |
|
129 | 129 | $users[] = $App->getCurrentUser(); |
130 | 130 | } |
131 | - else if(!is_array($for)){ |
|
132 | - if($for === 'all'){ |
|
131 | + else if (!is_array($for)) { |
|
132 | + if ($for === 'all') { |
|
133 | 133 | $users = $App->getLoggedUsers(); |
134 | 134 | } |
135 | - else{ |
|
135 | + else { |
|
136 | 136 | $users[] = $for; |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | 140 | $deleteOn = self::getDeleteOn(); |
141 | - foreach ($users as $user){ |
|
141 | + foreach ($users as $user) { |
|
142 | 142 | $record = $this->newRecord(); |
143 | 143 | $record->user = $user; |
144 | 144 | $record->data = $reloadSelector; |
@@ -164,20 +164,20 @@ discard block |
||
164 | 164 | { |
165 | 165 | $App = $this->App(); |
166 | 166 | $users = array(); |
167 | - if(!isset($for)){ |
|
167 | + if (!isset($for)) { |
|
168 | 168 | $users[] = $App->getCurrentUser(); |
169 | 169 | } |
170 | - else if(!is_array($for)){ |
|
171 | - if($for === 'all'){ |
|
170 | + else if (!is_array($for)) { |
|
171 | + if ($for === 'all') { |
|
172 | 172 | $users = $App->getLoggedUsers(); |
173 | 173 | } |
174 | - else{ |
|
174 | + else { |
|
175 | 175 | $users[] = $for; |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | $deleteOn = self::getDeleteOn(); |
180 | - foreach ($users as $user){ |
|
180 | + foreach ($users as $user) { |
|
181 | 181 | $record = $this->newRecord(); |
182 | 182 | $record->user = $user; |
183 | 183 | $record->data = bab_json_encode($data); |
@@ -127,12 +127,10 @@ discard block |
||
127 | 127 | $users = array(); |
128 | 128 | if(!isset($for)){ |
129 | 129 | $users[] = $App->getCurrentUser(); |
130 | - } |
|
131 | - else if(!is_array($for)){ |
|
130 | + } else if(!is_array($for)){ |
|
132 | 131 | if($for === 'all'){ |
133 | 132 | $users = $App->getLoggedUsers(); |
134 | - } |
|
135 | - else{ |
|
133 | + } else{ |
|
136 | 134 | $users[] = $for; |
137 | 135 | } |
138 | 136 | } |
@@ -166,12 +164,10 @@ discard block |
||
166 | 164 | $users = array(); |
167 | 165 | if(!isset($for)){ |
168 | 166 | $users[] = $App->getCurrentUser(); |
169 | - } |
|
170 | - else if(!is_array($for)){ |
|
167 | + } else if(!is_array($for)){ |
|
171 | 168 | if($for === 'all'){ |
172 | 169 | $users = $App->getLoggedUsers(); |
173 | - } |
|
174 | - else{ |
|
170 | + } else{ |
|
175 | 171 | $users[] = $for; |
176 | 172 | } |
177 | 173 | } |
@@ -351,8 +351,7 @@ discard block |
||
351 | 351 | if(isset($linkType)){ |
352 | 352 | if(is_array($linkType)){ |
353 | 353 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
354 | - } |
|
355 | - else{ |
|
354 | + } else{ |
|
356 | 355 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
357 | 356 | } |
358 | 357 | } |
@@ -379,8 +378,7 @@ discard block |
||
379 | 378 | if(isset($linkType)){ |
380 | 379 | if(is_array($linkType)){ |
381 | 380 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
382 | - } |
|
383 | - else{ |
|
381 | + } else{ |
|
384 | 382 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
385 | 383 | } |
386 | 384 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $value = $this->oParentSet->getBackend()->getRecordValue($this, $sFieldName); |
60 | 60 | $field = $this->oParentSet->$sFieldName; |
61 | - if(! is_null($value) && $field instanceof ORMFkField){ |
|
61 | + if (!is_null($value) && $field instanceof ORMFkField) { |
|
62 | 62 | |
63 | 63 | $sClassName = $field->getForeignSetName(); |
64 | 64 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function App() |
95 | 95 | { |
96 | - if(! isset($this->app)){ |
|
96 | + if (!isset($this->app)) { |
|
97 | 97 | // If the app object was not specified (through the setApp() method), |
98 | 98 | // we set it as parent set's App. |
99 | 99 | $this->setApp($this->getParentSet() |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $App = $this->App(); |
115 | 115 | $rClass = new \ReflectionClass(get_class($this)); |
116 | 116 | $component = $App->getComponentByName($rClass->getShortName()); |
117 | - if(isset($component)){ |
|
117 | + if (isset($component)) { |
|
118 | 118 | return $component->getRecordClassName(); |
119 | 119 | // list(, $classname) = explode('_', $component->getRecordClassName()); |
120 | 120 | // return $classname; |
@@ -130,11 +130,11 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getRef() |
132 | 132 | { |
133 | - if(! isset($this->id)){ |
|
133 | + if (!isset($this->id)) { |
|
134 | 134 | throw new AppException('Trying to get the reference string of a record without an id.'); |
135 | 135 | } |
136 | 136 | $classname = $this->getClassName(); |
137 | - return $classname . ':' . $this->id; |
|
137 | + return $classname.':'.$this->id; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | { |
162 | 162 | $App = $this->App(); |
163 | 163 | |
164 | - if(! isset($deletedStatus)){ |
|
164 | + if (!isset($deletedStatus)) { |
|
165 | 165 | $deletedStatus = AppTraceableRecord::DELETED_STATUS_DELETED; |
166 | 166 | } |
167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | // referenced elements. |
174 | 174 | $manyRelations = $set->getHasManyRelations(); |
175 | 175 | |
176 | - foreach ($manyRelations as $manyRelation){ |
|
176 | + foreach ($manyRelations as $manyRelation) { |
|
177 | 177 | /* @var $manyRelation ORMManyRelation */ |
178 | 178 | |
179 | 179 | $foreignSetClassName = $manyRelation->getForeignSetClassName(); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
189 | 189 | |
190 | - foreach ($foreignRecords as $foreignRecord){ |
|
190 | + foreach ($foreignRecords as $foreignRecord) { |
|
191 | 191 | $foreignRecord->$foreignSetFieldName = 0; |
192 | 192 | $foreignRecord->save(); |
193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
200 | 200 | |
201 | - foreach ($foreignRecords as $foreignRecord){ |
|
201 | + foreach ($foreignRecords as $foreignRecord) { |
|
202 | 202 | $foreignRecord->delete(); |
203 | 203 | } |
204 | 204 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | // referenced elements. |
245 | 245 | $manyRelations = $set->getHasManyRelations(); |
246 | 246 | |
247 | - foreach ($manyRelations as $manyRelation){ |
|
247 | + foreach ($manyRelations as $manyRelation) { |
|
248 | 248 | /* @var $manyRelation ORMManyRelation */ |
249 | 249 | |
250 | 250 | $foreignSetClassName = $manyRelation->getForeignSetClassName(); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // $foreignSet = new $foreignSetClassName($App); |
255 | 255 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
256 | 256 | |
257 | - foreach ($foreignRecords as $foreignRecord){ |
|
257 | + foreach ($foreignRecords as $foreignRecord) { |
|
258 | 258 | $foreignRecord->$foreignSetFieldName = $id; |
259 | 259 | $foreignRecord->save(); |
260 | 260 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $links = $linkSet->select($linkSet->sourceClass->is($recordClassName) |
268 | 268 | ->_AND_($linkSet->sourceId->is($recordId))); |
269 | 269 | |
270 | - foreach ($links as $link){ |
|
270 | + foreach ($links as $link) { |
|
271 | 271 | $link->sourceId = $id; |
272 | 272 | $link->save(); |
273 | 273 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $links = $linkSet->select($linkSet->targetClass->is($recordClassName) |
276 | 276 | ->_AND_($linkSet->targetId->is($recordId))); |
277 | 277 | |
278 | - foreach ($links as $link){ |
|
278 | + foreach ($links as $link) { |
|
279 | 279 | $link->targetId = $id; |
280 | 280 | $link->save(); |
281 | 281 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | $relatedRecords = array(); |
302 | 302 | |
303 | - foreach ($manyRelations as $manyRelation){ |
|
303 | + foreach ($manyRelations as $manyRelation) { |
|
304 | 304 | /* @var $manyRelation ORMManyRelation */ |
305 | 305 | |
306 | 306 | $foreignSetClassName = $manyRelation->getForeignSetClassName(); |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | // $foreignSet = new $foreignSetClassName($App); |
312 | 312 | $foreignRecords = $foreignSet->select($foreignSet->$foreignSetFieldName->is($recordId)); |
313 | 313 | |
314 | - if($foreignRecords->count() > 0){ |
|
314 | + if ($foreignRecords->count() > 0) { |
|
315 | 315 | $relatedRecords[$foreignSetClassName] = $foreignRecords; |
316 | 316 | } |
317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | { |
329 | 329 | $path = $this->App()->uploadPath(); |
330 | 330 | |
331 | - if(null === $path){ |
|
331 | + if (null === $path) { |
|
332 | 332 | throw new \Exception('Missing upload path information'); |
333 | 333 | return null; |
334 | 334 | } |
@@ -348,12 +348,12 @@ discard block |
||
348 | 348 | $linkSet = $App->LinkSet(); |
349 | 349 | |
350 | 350 | $sourceClass = $source->getClassName(); |
351 | - if(strpos($sourceClass, '\\')){ |
|
351 | + if (strpos($sourceClass, '\\')) { |
|
352 | 352 | $targetClass = (new \ReflectionClass($sourceClass))->getShortName(); |
353 | 353 | } |
354 | 354 | |
355 | 355 | $targetClass = $this->getClassName(); |
356 | - if(strpos($targetClass, '\\')){ |
|
356 | + if (strpos($targetClass, '\\')) { |
|
357 | 357 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
358 | 358 | } |
359 | 359 | |
@@ -361,11 +361,11 @@ discard block |
||
361 | 361 | ->_AND_($linkSet->sourceId->is($source->id)) |
362 | 362 | ->_AND_($linkSet->targetClass->is($targetClass)) |
363 | 363 | ->_AND_($linkSet->targetId->is($this->id)); |
364 | - if(isset($linkType)){ |
|
365 | - if(is_array($linkType)){ |
|
364 | + if (isset($linkType)) { |
|
365 | + if (is_array($linkType)) { |
|
366 | 366 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
367 | 367 | } |
368 | - else{ |
|
368 | + else { |
|
369 | 369 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
370 | 370 | } |
371 | 371 | } |
@@ -388,22 +388,22 @@ discard block |
||
388 | 388 | $linkSet = $App->LinkSet(); |
389 | 389 | |
390 | 390 | $sourceClass = $this->getClassName(); |
391 | - if(strpos($sourceClass, '\\')){ |
|
391 | + if (strpos($sourceClass, '\\')) { |
|
392 | 392 | $targetClass = (new \ReflectionClass($sourceClass))->getShortName(); |
393 | 393 | } |
394 | 394 | |
395 | 395 | $targetClass = $target->getClassName(); |
396 | - if(strpos($targetClass, '\\')){ |
|
396 | + if (strpos($targetClass, '\\')) { |
|
397 | 397 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
398 | 398 | } |
399 | 399 | |
400 | 400 | $criteria = $linkSet->all($linkSet->targetClass->is($targetClass), $linkSet->targetId->is($target->id), $linkSet->sourceClass->is($sourceClass), $linkSet->sourceId->is($this->id)); |
401 | 401 | |
402 | - if(isset($linkType)){ |
|
403 | - if(is_array($linkType)){ |
|
402 | + if (isset($linkType)) { |
|
403 | + if (is_array($linkType)) { |
|
404 | 404 | $criteria = $criteria->_AND_($linkSet->type->in($linkType)); |
405 | 405 | } |
406 | - else{ |
|
406 | + else { |
|
407 | 407 | $criteria = $criteria->_AND_($linkSet->type->is($linkType)); |
408 | 408 | } |
409 | 409 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | protected function importProperty($name, $value) |
467 | 467 | { |
468 | - if(((string) $this->$name) !== ((string) $value)){ |
|
468 | + if (((string) $this->$name) !== ((string) $value)) { |
|
469 | 469 | $this->$name = $value; |
470 | 470 | return 1; |
471 | 471 | } |
@@ -485,13 +485,13 @@ discard block |
||
485 | 485 | */ |
486 | 486 | protected function importDate($name, $value) |
487 | 487 | { |
488 | - if(preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)){ |
|
488 | + if (preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $value)) { |
|
489 | 489 | return $this->importProperty($name, $value); |
490 | 490 | } |
491 | 491 | |
492 | 492 | // try in DD/MM/YYYY format |
493 | 493 | |
494 | - if(preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)){ |
|
494 | + if (preg_match('/(?P<day>[0-9]+)\/(?P<month>[0-9]+)\/(?P<year>[0-9]{2,4})/', $value, $matches)) { |
|
495 | 495 | |
496 | 496 | $value = sprintf('%04d-%02d-%02d', (int) $matches['year'], (int) $matches['month'], (int) $matches['day']); |
497 | 497 | |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | $customContainers->groupBy($customContainerSet->view); |
512 | 512 | |
513 | 513 | $views = array(); |
514 | - foreach ($customContainers as $customContainer){ |
|
514 | + foreach ($customContainers as $customContainer) { |
|
515 | 515 | $views[] = $customContainer->view; |
516 | 516 | } |
517 | 517 | |
518 | - if(empty($views)){ |
|
518 | + if (empty($views)) { |
|
519 | 519 | $views[] = ''; |
520 | 520 | } |
521 | 521 | |
@@ -599,9 +599,9 @@ discard block |
||
599 | 599 | */ |
600 | 600 | public function requireReadable($message = null) |
601 | 601 | { |
602 | - if(! $this->isReadable()){ |
|
602 | + if (!$this->isReadable()) { |
|
603 | 603 | $App = $this->App(); |
604 | - if(! isset($message)){ |
|
604 | + if (!isset($message)) { |
|
605 | 605 | $message = $App->translate('Access denied'); |
606 | 606 | } |
607 | 607 | throw new AppAccessException($message); |
@@ -617,9 +617,9 @@ discard block |
||
617 | 617 | */ |
618 | 618 | public function requireUpdatable($message = null) |
619 | 619 | { |
620 | - if(! $this->isUpdatable()){ |
|
620 | + if (!$this->isUpdatable()) { |
|
621 | 621 | $App = $this->App(); |
622 | - if(! isset($message)){ |
|
622 | + if (!isset($message)) { |
|
623 | 623 | $message = $App->translate('Access denied'); |
624 | 624 | } |
625 | 625 | throw new AppAccessException($message); |
@@ -635,9 +635,9 @@ discard block |
||
635 | 635 | */ |
636 | 636 | public function requireDeletable($message = null) |
637 | 637 | { |
638 | - if(! $this->isDeletable()){ |
|
638 | + if (!$this->isDeletable()) { |
|
639 | 639 | $App = $this->App(); |
640 | - if(! isset($message)){ |
|
640 | + if (!isset($message)) { |
|
641 | 641 | $message = $App->translate('Access denied'); |
642 | 642 | } |
643 | 643 | throw new AppAccessException($message); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function getSource() |
46 | 46 | { |
47 | 47 | $App = $this->App(); |
48 | - return $App->getRecordByRef($this->sourceClass . ':' . $this->sourceId); |
|
48 | + return $App->getRecordByRef($this->sourceClass.':'.$this->sourceId); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function getTarget() |
55 | 55 | { |
56 | 56 | $App = $this->App(); |
57 | - return $App->getRecordByRef($this->targetClass . ':' . $this->targetId); |
|
57 | + return $App->getRecordByRef($this->targetClass.':'.$this->targetId); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 |
@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | public function selectUserNotifications($user = null, $seen = false) |
67 | 67 | { |
68 | - if(! isset($user)){ |
|
68 | + if (!isset($user)) { |
|
69 | 69 | $App = $this->App(); |
70 | 70 | $user = $App->getCurrentUser(); |
71 | 71 | } |
@@ -170,8 +170,7 @@ discard block |
||
170 | 170 | if(isset($linkType)){ |
171 | 171 | if(is_array($linkType)){ |
172 | 172 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
173 | - } |
|
174 | - else{ |
|
173 | + } else{ |
|
175 | 174 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
176 | 175 | } |
177 | 176 | } |
@@ -207,8 +206,7 @@ discard block |
||
207 | 206 | if(isset($linkType)){ |
208 | 207 | if(is_array($linkType)){ |
209 | 208 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
210 | - } |
|
211 | - else{ |
|
209 | + } else{ |
|
212 | 210 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
213 | 211 | } |
214 | 212 | } |
@@ -230,8 +228,7 @@ discard block |
||
230 | 228 | if(isset($linkType)){ |
231 | 229 | if(is_array($linkType)){ |
232 | 230 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
233 | - } |
|
234 | - else{ |
|
231 | + } else{ |
|
235 | 232 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
236 | 233 | } |
237 | 234 | } |
@@ -263,8 +260,7 @@ discard block |
||
263 | 260 | if(isset($linkType)){ |
264 | 261 | if(is_array($linkType)){ |
265 | 262 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
266 | - } |
|
267 | - else{ |
|
263 | + } else{ |
|
268 | 264 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
269 | 265 | } |
270 | 266 | } |
@@ -329,8 +325,7 @@ discard block |
||
329 | 325 | if(isset($linkType)){ |
330 | 326 | if(is_array($linkType)){ |
331 | 327 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
332 | - } |
|
333 | - else{ |
|
328 | + } else{ |
|
334 | 329 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
335 | 330 | } |
336 | 331 | } |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | { |
92 | 92 | $link = $this->newRecord(); |
93 | 93 | $sourceClass = $source->getClassName(); |
94 | - if(strpos($sourceClass, '\\')){ |
|
94 | + if (strpos($sourceClass, '\\')) { |
|
95 | 95 | $sourceClass = (new \ReflectionClass($sourceClass))->getShortName(); |
96 | 96 | } |
97 | 97 | $targetClass = $target->getClassName(); |
98 | - if(strpos($targetClass, '\\')){ |
|
98 | + if (strpos($targetClass, '\\')) { |
|
99 | 99 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
100 | 100 | } |
101 | 101 | $link->sourceClass = $sourceClass; |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public function joinSource($sourceClass) |
116 | 116 | { |
117 | - if(strpos($sourceClass, '\\')){ |
|
117 | + if (strpos($sourceClass, '\\')) { |
|
118 | 118 | $sourceClass = (new \ReflectionClass($sourceClass))->getShortName(); |
119 | 119 | } |
120 | - if(! $this->sourceId instanceof $sourceClass){ |
|
121 | - $this->hasOne('sourceId', $sourceClass . 'Set'); |
|
120 | + if (!$this->sourceId instanceof $sourceClass) { |
|
121 | + $this->hasOne('sourceId', $sourceClass.'Set'); |
|
122 | 122 | $this->join('sourceId'); |
123 | 123 | } |
124 | 124 | } |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | */ |
129 | 129 | public function joinTarget($targetClass = null) |
130 | 130 | { |
131 | - if(strpos($targetClass, '\\')){ |
|
131 | + if (strpos($targetClass, '\\')) { |
|
132 | 132 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
133 | 133 | } |
134 | - if(! $this->targetId instanceof $targetClass){ |
|
135 | - $this->hasOne('targetId', $targetClass . 'Set'); |
|
134 | + if (!$this->targetId instanceof $targetClass) { |
|
135 | + $this->hasOne('targetId', $targetClass.'Set'); |
|
136 | 136 | $this->join('targetId'); |
137 | 137 | } |
138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function sourceIsA($recordClass) |
145 | 145 | { |
146 | - if(strpos($recordClass, '\\')){ |
|
146 | + if (strpos($recordClass, '\\')) { |
|
147 | 147 | $recordClass = (new \ReflectionClass($recordClass))->getShortName(); |
148 | 148 | } |
149 | 149 | return $this->sourceClass->is($recordClass); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function targetIsA($recordClass) |
166 | 166 | { |
167 | - if(strpos($recordClass, '\\')){ |
|
167 | + if (strpos($recordClass, '\\')) { |
|
168 | 168 | $recordClass = (new \ReflectionClass($recordClass))->getShortName(); |
169 | 169 | } |
170 | 170 | return $this->targetClass->is($recordClass); |
@@ -187,24 +187,24 @@ discard block |
||
187 | 187 | $criteria = $this->sourceIs($object); |
188 | 188 | |
189 | 189 | |
190 | - if(isset($targetClass)){ |
|
191 | - if(strpos($targetClass, '\\')){ |
|
190 | + if (isset($targetClass)) { |
|
191 | + if (strpos($targetClass, '\\')) { |
|
192 | 192 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
193 | 193 | } |
194 | 194 | $this->joinTarget($targetClass); |
195 | 195 | $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
196 | 196 | } |
197 | 197 | |
198 | - if(isset($linkType)){ |
|
199 | - if(is_array($linkType)){ |
|
198 | + if (isset($linkType)) { |
|
199 | + if (is_array($linkType)) { |
|
200 | 200 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
201 | 201 | } |
202 | - else{ |
|
202 | + else { |
|
203 | 203 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - if(is_a($this->targetId, 'app_TraceableRecordSet')){ |
|
207 | + if (is_a($this->targetId, 'app_TraceableRecordSet')) { |
|
208 | 208 | $criteria = $criteria->_AND_($this->targetId->deleted->is(false)); |
209 | 209 | } |
210 | 210 | |
@@ -219,27 +219,27 @@ discard block |
||
219 | 219 | $sourceClass = null; |
220 | 220 | $sourceIds = array(); |
221 | 221 | |
222 | - foreach ($objects as $obj){ |
|
223 | - if(is_null($sourceClass)){ |
|
222 | + foreach ($objects as $obj) { |
|
223 | + if (is_null($sourceClass)) { |
|
224 | 224 | $sourceClass = $obj->getClassName(); |
225 | 225 | } |
226 | 226 | $sourceIds[] = $obj->id; |
227 | 227 | } |
228 | 228 | $criteria = $this->sourceId->in($sourceIds)->_AND_($this->sourceClass->is($sourceClass)); |
229 | 229 | |
230 | - if(isset($targetClass)){ |
|
231 | - if(strpos($targetClass, '\\')){ |
|
230 | + if (isset($targetClass)) { |
|
231 | + if (strpos($targetClass, '\\')) { |
|
232 | 232 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
233 | 233 | } |
234 | 234 | $this->joinTarget($targetClass); |
235 | 235 | $criteria = $criteria->_AND_($this->targetClass->is($targetClass)); |
236 | 236 | } |
237 | 237 | |
238 | - if(isset($linkType)){ |
|
239 | - if(is_array($linkType)){ |
|
238 | + if (isset($linkType)) { |
|
239 | + if (is_array($linkType)) { |
|
240 | 240 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
241 | 241 | } |
242 | - else{ |
|
242 | + else { |
|
243 | 243 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
244 | 244 | } |
245 | 245 | } |
@@ -253,19 +253,19 @@ discard block |
||
253 | 253 | { |
254 | 254 | $criteria = $this->targetIs($object); |
255 | 255 | |
256 | - if(isset($sourceClass)){ |
|
257 | - if(strpos($sourceClass, '\\')){ |
|
256 | + if (isset($sourceClass)) { |
|
257 | + if (strpos($sourceClass, '\\')) { |
|
258 | 258 | $sourceClass = (new \ReflectionClass($sourceClass))->getShortName(); |
259 | 259 | } |
260 | 260 | $this->joinSource($sourceClass); |
261 | 261 | $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
262 | 262 | } |
263 | 263 | |
264 | - if(isset($linkType)){ |
|
265 | - if(is_array($linkType)){ |
|
264 | + if (isset($linkType)) { |
|
265 | + if (is_array($linkType)) { |
|
266 | 266 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
267 | 267 | } |
268 | - else{ |
|
268 | + else { |
|
269 | 269 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
270 | 270 | } |
271 | 271 | } |
@@ -281,27 +281,27 @@ discard block |
||
281 | 281 | $targetClass = null; |
282 | 282 | $targetIds = array(); |
283 | 283 | |
284 | - foreach ($objects as $obj){ |
|
285 | - if(is_null($targetClass)){ |
|
284 | + foreach ($objects as $obj) { |
|
285 | + if (is_null($targetClass)) { |
|
286 | 286 | $targetClass = $obj->getClassName(); |
287 | 287 | } |
288 | 288 | $targetIds[] = $obj->id; |
289 | 289 | } |
290 | 290 | $criteria = $this->targetId->in($targetIds)->_AND_($this->targetClass->is($targetClass)); |
291 | 291 | |
292 | - if(isset($sourceClass)){ |
|
293 | - if(strpos($sourceClass, '\\')){ |
|
292 | + if (isset($sourceClass)) { |
|
293 | + if (strpos($sourceClass, '\\')) { |
|
294 | 294 | $sourceClass = (new \ReflectionClass($sourceClass))->getShortName(); |
295 | 295 | } |
296 | 296 | $this->joinSource($sourceClass); |
297 | 297 | $criteria = $criteria->_AND_($this->sourceClass->is($sourceClass)); |
298 | 298 | } |
299 | 299 | |
300 | - if(isset($linkType)){ |
|
301 | - if(is_array($linkType)){ |
|
300 | + if (isset($linkType)) { |
|
301 | + if (is_array($linkType)) { |
|
302 | 302 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
303 | 303 | } |
304 | - else{ |
|
304 | + else { |
|
305 | 305 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
306 | 306 | } |
307 | 307 | } |
@@ -325,20 +325,20 @@ discard block |
||
325 | 325 | |
326 | 326 | $criteria = $set->sourceId->is($object->id)->_AND_($set->sourceClass->is($object->getClassName())); |
327 | 327 | |
328 | - if(null !== $targetClass){ |
|
329 | - if(strpos($targetClass, '\\')){ |
|
328 | + if (null !== $targetClass) { |
|
329 | + if (strpos($targetClass, '\\')) { |
|
330 | 330 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
331 | 331 | } |
332 | 332 | $criteria = $criteria->_AND_($set->targetClass->is($targetClass)); |
333 | 333 | } |
334 | - if(null !== $linkType){ |
|
334 | + if (null !== $linkType) { |
|
335 | 335 | $criteria = $criteria->_AND_($set->type->is($linkType)); |
336 | 336 | } |
337 | 337 | |
338 | - if($deleteTarget){ |
|
339 | - foreach ($set->select($criteria) as $link){ |
|
338 | + if ($deleteTarget) { |
|
339 | + foreach ($set->select($criteria) as $link) { |
|
340 | 340 | |
341 | - $className = $link->targetClass . 'Set'; |
|
341 | + $className = $link->targetClass.'Set'; |
|
342 | 342 | |
343 | 343 | // remove prefix |
344 | 344 | |
@@ -363,22 +363,22 @@ discard block |
||
363 | 363 | public function deleteLink($source, $target, $linkType = null) |
364 | 364 | { |
365 | 365 | $sourceClass = $source->getClassName(); |
366 | - if(strpos($sourceClass, '\\')){ |
|
366 | + if (strpos($sourceClass, '\\')) { |
|
367 | 367 | $sourceClass = (new \ReflectionClass($sourceClass))->getShortName(); |
368 | 368 | } |
369 | 369 | $targetClass = $target->getClassName(); |
370 | - if(strpos($targetClass, '\\')){ |
|
370 | + if (strpos($targetClass, '\\')) { |
|
371 | 371 | $targetClass = (new \ReflectionClass($targetClass))->getShortName(); |
372 | 372 | } |
373 | 373 | $criteria = $this->sourceId->is($source->id) |
374 | 374 | ->_AND_($this->sourceClass->is($sourceClass)) |
375 | 375 | ->_AND_($this->targetId->is($target->id)) |
376 | 376 | ->_AND_($this->targetClass->is($targetClass)); |
377 | - if(isset($linkType)){ |
|
378 | - if(is_array($linkType)){ |
|
377 | + if (isset($linkType)) { |
|
378 | + if (is_array($linkType)) { |
|
379 | 379 | $criteria = $criteria->_AND_($this->type->in($linkType)); |
380 | 380 | } |
381 | - else{ |
|
381 | + else { |
|
382 | 382 | $criteria = $criteria->_AND_($this->type->is($linkType)); |
383 | 383 | } |
384 | 384 | } |