SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- /**
- * @var Employee[]|EmployeeGroup[] $newAssignees
- * @var Employee[]|EmployeeGroup[] $oldAssignees
- * @return array
- */
- private function getAssigneesTypes($oldAssignees, $newAssignees) {
- $deleted = [];
- $added = [];
- $modified = [];
- foreach ($oldAssignees as $old) {
- $mod = false;
- foreach ($newAssignees as $new) {
- if ($old->getId() == $new->getId()) {
- $modified[] = $old;
- $mod = true;
- }
- }
- if (!$mod) {
- $deleted[] = $old;
- }
- }
- foreach ($newAssignees as $new) {
- $mod = false;
- foreach ($oldAssignees as $old) {
- if ($old->getId() == $new->getId()) {
- $mod = true;
- }
- }
- if (!$mod) {
- $added[] = $new;
- }
- }
- return [
- 'deleted' => $deleted,
- 'added' => $added,
- 'modified' => $modified,
- ];
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.