From 29b5acd09e87b1bfe9cf58f2e3dc59e38b7e6120 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Mon, 24 Sep 2018 09:08:03 +0200 Subject: [PATCH] Minor - change entity association names --- src/CourseBundle/Entity/CGroupInfo.php | 56 +++++++++++++++++++--- src/CourseBundle/Entity/CGroupRelTutor.php | 4 +- src/CourseBundle/Entity/CGroupRelUser.php | 4 +- src/UserBundle/Entity/User.php | 28 ++++++----- 4 files changed, 70 insertions(+), 22 deletions(-) diff --git a/src/CourseBundle/Entity/CGroupInfo.php b/src/CourseBundle/Entity/CGroupInfo.php index 1a1e16ec80..8e3b546d1f 100644 --- a/src/CourseBundle/Entity/CGroupInfo.php +++ b/src/CourseBundle/Entity/CGroupInfo.php @@ -179,14 +179,14 @@ class CGroupInfo * * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="group") */ - protected $userMemberships; + protected $members; /** * @var ArrayCollection * * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="group") */ - protected $tutorMemberships; + protected $tutors; /** * Set name. @@ -616,19 +616,63 @@ class CGroupInfo return $this; } + /** + * @return int + */ + public function getDocAccess(): int + { + return $this->docAccess; + } + + /** + * @param int $docAccess + * + * @return CGroupInfo + */ + public function setDocAccess(int $docAccess): CGroupInfo + { + $this->docAccess = $docAccess; + + return $this; + } + /** * @return ArrayCollection */ - public function getUserMemberships(): ArrayCollection + public function getMembers(): ArrayCollection { - return $this->userMemberships; + return $this->members; + } + + /** + * @param ArrayCollection $members + * + * @return CGroupInfo + */ + public function setMembers(ArrayCollection $members): CGroupInfo + { + $this->members = $members; + + return $this; } /** * @return ArrayCollection */ - public function getTutorMemberships(): ArrayCollection + public function getTutors(): ArrayCollection + { + return $this->tutors; + } + + /** + * @param ArrayCollection $tutors + * + * @return CGroupInfo + */ + public function setTutors(ArrayCollection $tutors): CGroupInfo { - return $this->tutorMemberships; + $this->tutors = $tutors; + + return $this; } } diff --git a/src/CourseBundle/Entity/CGroupRelTutor.php b/src/CourseBundle/Entity/CGroupRelTutor.php index 8ad250c57c..fd9c5eb91e 100644 --- a/src/CourseBundle/Entity/CGroupRelTutor.php +++ b/src/CourseBundle/Entity/CGroupRelTutor.php @@ -45,7 +45,7 @@ class CGroupRelTutor /** * @var User * - * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="tutoredCourseGroups") + * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courseGroupsAsTutor") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) */ protected $user; @@ -53,7 +53,7 @@ class CGroupRelTutor /** * @var CGroupInfo * - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo", inversedBy="tutorMemberships") + * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo", inversedBy="tutors") * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=false) */ protected $group; diff --git a/src/CourseBundle/Entity/CGroupRelUser.php b/src/CourseBundle/Entity/CGroupRelUser.php index 6e39b44fa3..515020e330 100644 --- a/src/CourseBundle/Entity/CGroupRelUser.php +++ b/src/CourseBundle/Entity/CGroupRelUser.php @@ -45,7 +45,7 @@ class CGroupRelUser /** * @var User * - * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courseGroupMemberships") + * @ORM\ManyToOne(targetEntity="Chamilo\UserBundle\Entity\User", inversedBy="courseGroupsAsMember") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false) */ protected $user; @@ -53,7 +53,7 @@ class CGroupRelUser /** * @var CGroupInfo * - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo", inversedBy="userMemberships") + * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CGroupInfo", inversedBy="members") * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=false) */ protected $group; diff --git a/src/UserBundle/Entity/User.php b/src/UserBundle/Entity/User.php index 0da44e5079..c48025de63 100644 --- a/src/UserBundle/Entity/User.php +++ b/src/UserBundle/Entity/User.php @@ -135,12 +135,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement /** * @var bool + * * @ORM\Column(name="locked", type="boolean") */ protected $locked; /** * @var bool + * * @ORM\Column(name="enabled", type="boolean") */ //protected $enabled; @@ -159,12 +161,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement /** * @var \DateTime + * * @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true, unique=false) */ protected $credentialsExpireAt; /** * @var \DateTime + * * @ORM\Column(name="expires_at", type="datetime", nullable=true, unique=false) */ protected $expiresAt; @@ -474,14 +478,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement * * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="user") */ - private $courseGroupMemberships; + protected $courseGroupsAsMember; /** * @var ArrayCollection * * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="user") */ - private $tutoredCourseGroups; + protected $courseGroupsAsTutor; /** * Constructor. @@ -512,8 +516,8 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement $this->roles = []; $this->credentialsExpired = false; - $this->courseGroupMemberships = new ArrayCollection(); - $this->tutoredCourseGroups = new ArrayCollection(); + $this->courseGroupsAsMember = new ArrayCollection(); + $this->courseGroupsAsTutor = new ArrayCollection(); } /** @@ -1954,17 +1958,17 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement /** * @return ArrayCollection */ - public function getCourseGroupMemberships(): ArrayCollection + public function getCourseGroupsAsMember(): ArrayCollection { - return $this->courseGroupMemberships; + return $this->courseGroupsAsMember; } /** * @return ArrayCollection */ - public function getTutoredCourseGroups(): ArrayCollection + public function getCourseGroupsAsTutor(): ArrayCollection { - return $this->tutoredCourseGroups; + return $this->courseGroupsAsTutor; } /** @@ -1972,14 +1976,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement * * @return ArrayCollection */ - public function getGroupMembershipsInCourse(Course $course): ArrayCollection + public function getCourseGroupsAsMemberFromCourse(Course $course): ArrayCollection { $criteria = Criteria::create(); $criteria->where( Criteria::expr()->eq('cId', $course) ); - return $this->courseGroupMemberships->matching($criteria); + return $this->courseGroupsAsMember->matching($criteria); } /** @@ -1987,13 +1991,13 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement * * @return ArrayCollection */ - public function getTutoredGroupsInCourse(Course $course): ArrayCollection + public function getCourseGroupsAsTutorFromCourse(Course $course): ArrayCollection { $criteria = Criteria::create(); $criteria->where( Criteria::expr()->eq('cId', $course->getId()) ); - return $this->tutoredCourseGroups->matching($criteria); + return $this->courseGroupsAsTutor->matching($criteria); } }