| @@ 52-63 (lines=12) @@ | ||
| 49 | 'businessUnits' => [] |
|
| 50 | ]; |
|
| 51 | ||
| 52 | if (!empty($options['businessUnits'])) { |
|
| 53 | if (is_array($options['businessUnits'])) { |
|
| 54 | /** @var BusinessUnit $businessUnit */ |
|
| 55 | foreach ($options['businessUnits'] as $businessUnit) { |
|
| 56 | if ($businessUnit instanceof BusinessUnit) { |
|
| 57 | $owners['businessUnits'][] = $businessUnit->getId(); |
|
| 58 | $needUpdate = true; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | } |
|
| 62 | unset($options['businessUnits']); |
|
| 63 | } |
|
| 64 | ||
| 65 | if (!empty($options['owners'])) { |
|
| 66 | if (is_array($options['owners'])) { |
|
| @@ 65-76 (lines=12) @@ | ||
| 62 | unset($options['businessUnits']); |
|
| 63 | } |
|
| 64 | ||
| 65 | if (!empty($options['owners'])) { |
|
| 66 | if (is_array($options['owners'])) { |
|
| 67 | /** @var User $user */ |
|
| 68 | foreach ($options['owners'] as $user) { |
|
| 69 | if ($user instanceof User) { |
|
| 70 | $owners['users'][] = $user->getId(); |
|
| 71 | $needUpdate = true; |
|
| 72 | } |
|
| 73 | } |
|
| 74 | } |
|
| 75 | unset($options['owners']); |
|
| 76 | } |
|
| 77 | ||
| 78 | if ($needUpdate) { |
|
| 79 | $options['owners'] = $owners; |
|