Minor - change entity association names

pull/2715/head
Julio Montoya 6 years ago
parent 8231595b88
commit 29b5acd09e
  1. 56
      src/CourseBundle/Entity/CGroupInfo.php
  2. 4
      src/CourseBundle/Entity/CGroupRelTutor.php
  3. 4
      src/CourseBundle/Entity/CGroupRelUser.php
  4. 28
      src/UserBundle/Entity/User.php

@ -179,14 +179,14 @@ class CGroupInfo
* *
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="group") * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="group")
*/ */
protected $userMemberships; protected $members;
/** /**
* @var ArrayCollection * @var ArrayCollection
* *
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="group") * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="group")
*/ */
protected $tutorMemberships; protected $tutors;
/** /**
* Set name. * Set name.
@ -616,19 +616,63 @@ class CGroupInfo
return $this; 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 * @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 * @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;
} }
} }

@ -45,7 +45,7 @@ class CGroupRelTutor
/** /**
* @var User * @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) * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*/ */
protected $user; protected $user;
@ -53,7 +53,7 @@ class CGroupRelTutor
/** /**
* @var CGroupInfo * @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) * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=false)
*/ */
protected $group; protected $group;

@ -45,7 +45,7 @@ class CGroupRelUser
/** /**
* @var User * @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) * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=false)
*/ */
protected $user; protected $user;
@ -53,7 +53,7 @@ class CGroupRelUser
/** /**
* @var CGroupInfo * @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) * @ORM\JoinColumn(name="group_id", referencedColumnName="iid", nullable=false)
*/ */
protected $group; protected $group;

@ -135,12 +135,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
/** /**
* @var bool * @var bool
*
* @ORM\Column(name="locked", type="boolean") * @ORM\Column(name="locked", type="boolean")
*/ */
protected $locked; protected $locked;
/** /**
* @var bool * @var bool
*
* @ORM\Column(name="enabled", type="boolean") * @ORM\Column(name="enabled", type="boolean")
*/ */
//protected $enabled; //protected $enabled;
@ -159,12 +161,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
/** /**
* @var \DateTime * @var \DateTime
*
* @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true, unique=false) * @ORM\Column(name="credentials_expire_at", type="datetime", nullable=true, unique=false)
*/ */
protected $credentialsExpireAt; protected $credentialsExpireAt;
/** /**
* @var \DateTime * @var \DateTime
*
* @ORM\Column(name="expires_at", type="datetime", nullable=true, unique=false) * @ORM\Column(name="expires_at", type="datetime", nullable=true, unique=false)
*/ */
protected $expiresAt; protected $expiresAt;
@ -474,14 +478,14 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
* *
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="user") * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelUser", mappedBy="user")
*/ */
private $courseGroupMemberships; protected $courseGroupsAsMember;
/** /**
* @var ArrayCollection * @var ArrayCollection
* *
* @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="user") * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CGroupRelTutor", mappedBy="user")
*/ */
private $tutoredCourseGroups; protected $courseGroupsAsTutor;
/** /**
* Constructor. * Constructor.
@ -512,8 +516,8 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
$this->roles = []; $this->roles = [];
$this->credentialsExpired = false; $this->credentialsExpired = false;
$this->courseGroupMemberships = new ArrayCollection(); $this->courseGroupsAsMember = new ArrayCollection();
$this->tutoredCourseGroups = new ArrayCollection(); $this->courseGroupsAsTutor = new ArrayCollection();
} }
/** /**
@ -1954,17 +1958,17 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
/** /**
* @return ArrayCollection * @return ArrayCollection
*/ */
public function getCourseGroupMemberships(): ArrayCollection public function getCourseGroupsAsMember(): ArrayCollection
{ {
return $this->courseGroupMemberships; return $this->courseGroupsAsMember;
} }
/** /**
* @return ArrayCollection * @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 * @return ArrayCollection
*/ */
public function getGroupMembershipsInCourse(Course $course): ArrayCollection public function getCourseGroupsAsMemberFromCourse(Course $course): ArrayCollection
{ {
$criteria = Criteria::create(); $criteria = Criteria::create();
$criteria->where( $criteria->where(
Criteria::expr()->eq('cId', $course) 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 * @return ArrayCollection
*/ */
public function getTutoredGroupsInCourse(Course $course): ArrayCollection public function getCourseGroupsAsTutorFromCourse(Course $course): ArrayCollection
{ {
$criteria = Criteria::create(); $criteria = Criteria::create();
$criteria->where( $criteria->where(
Criteria::expr()->eq('cId', $course->getId()) Criteria::expr()->eq('cId', $course->getId())
); );
return $this->tutoredCourseGroups->matching($criteria); return $this->courseGroupsAsTutor->matching($criteria);
} }
} }

Loading…
Cancel
Save