| @@ 516-533 (lines=18) @@ | ||
| 513 | * @param CourseRelUser $subscription |
|
| 514 | * @return bool |
|
| 515 | */ |
|
| 516 | private function hasSubscription(CourseRelUser $subscription) |
|
| 517 | { |
|
| 518 | if ($this->getUsers()->count()) { |
|
| 519 | $criteria = Criteria::create()->where( |
|
| 520 | Criteria::expr()->eq("user", $subscription->getUser()) |
|
| 521 | )->andWhere( |
|
| 522 | Criteria::expr()->eq("status", $subscription->getStatus()) |
|
| 523 | )->andWhere( |
|
| 524 | Criteria::expr()->eq("relationType", $subscription->getRelationType()) |
|
| 525 | ); |
|
| 526 | ||
| 527 | $relation = $this->getUsers()->matching($criteria); |
|
| 528 | ||
| 529 | return $relation->count() > 0; |
|
| 530 | } |
|
| 531 | ||
| 532 | return false; |
|
| 533 | } |
|
| 534 | ||
| 535 | /** |
|
| 536 | * @param User $user |
|
| @@ 369-386 (lines=18) @@ | ||
| 366 | * @param SessionRelUser $subscription |
|
| 367 | * @return bool |
|
| 368 | */ |
|
| 369 | public function hasUser(SessionRelUser $subscription) |
|
| 370 | { |
|
| 371 | if ($this->getUsers()->count()) { |
|
| 372 | $criteria = Criteria::create()->where( |
|
| 373 | Criteria::expr()->eq("user", $subscription->getUser()) |
|
| 374 | )->andWhere( |
|
| 375 | Criteria::expr()->eq("session", $subscription->getSession()) |
|
| 376 | )->andWhere( |
|
| 377 | Criteria::expr()->eq("relationType", $subscription->getRelationType()) |
|
| 378 | ); |
|
| 379 | ||
| 380 | $relation = $this->getUsers()->matching($criteria); |
|
| 381 | ||
| 382 | return $relation->count() > 0; |
|
| 383 | } |
|
| 384 | ||
| 385 | return false; |
|
| 386 | } |
|
| 387 | ||
| 388 | /** |
|
| 389 | * @return ArrayCollection |
|
| @@ 963-979 (lines=17) @@ | ||
| 960 | * @param SessionRelCourseRelUser $subscription |
|
| 961 | * @return bool |
|
| 962 | */ |
|
| 963 | public function hasUserCourseSubscription(SessionRelCourseRelUser $subscription) |
|
| 964 | { |
|
| 965 | if ($this->getUserCourseSubscriptions()->count()) { |
|
| 966 | $criteria = Criteria::create()->where( |
|
| 967 | Criteria::expr()->eq("user", $subscription->getUser()) |
|
| 968 | )->andWhere( |
|
| 969 | Criteria::expr()->eq("course", $subscription->getCourse()) |
|
| 970 | )->andWhere( |
|
| 971 | Criteria::expr()->eq("session", $subscription->getSession()) |
|
| 972 | ); |
|
| 973 | $relation = $this->getUserCourseSubscriptions()->matching($criteria); |
|
| 974 | ||
| 975 | return $relation->count() > 0; |
|
| 976 | } |
|
| 977 | ||
| 978 | return false; |
|
| 979 | } |
|
| 980 | ||
| 981 | /** |
|
| 982 | * @return Course |
|