Browse Source

Merge branch '1.10.x' of ssh://github.com/chamilo/chamilo-lms into 1.10.x

Julio Montoya 9 years ago
parent
commit
5589b85835
1 changed files with 19 additions and 0 deletions
  1. 19 0
      src/Chamilo/CoreBundle/Entity/Session.php

+ 19 - 0
src/Chamilo/CoreBundle/Entity/Session.php

@@ -987,4 +987,23 @@ class Session
         return $this->sendSubscriptionNotification;
     }
 
+    /**
+     * Get user from course by status
+     * @param \Chamilo\CoreBundle\Entity\Course $course
+     * @param string $status
+     * @return \Doctrine\Common\Collections\Collection|static
+     */
+    public function getUserCourseSubscriptionsByStatus(Course $course, $status)
+    {
+        $criteria = Criteria::create()
+            ->where(
+                Criteria::expr()->eq("course", $course)
+            )
+            ->andWhere(
+                Criteria::expr()->eq("status", $status)
+            );
+
+        return $this->userCourseSubscriptions->matching($criteria);
+    }
+
 }