getUsers()->isEmpty() || $reductionCart->getUsers()->contains($user)) { $conditionUser = true; } } return $conditionUser; } // isReductionCartMatchWithGroupUser public function matchWithGroupUser(ReductionCartInterface $reductionCart, UserInterface $user) { $conditionGroupUser = false; if ($user) { if ($user->getGroupUsers() && count($user->getGroupUsers()) > 0) { foreach ($user->getGroupUsers() as $groupUser) { if ($reductionCart->getGroupUsers()->isEmpty() || $reductionCart->getGroupUsers()->contains($groupUser)) { $conditionGroupUser = true; } } } else { if ($reductionCart->getGroupUsers()->isEmpty()) { $conditionGroupUser = true; } } } return $conditionGroupUser; } }