From b5184b436e885c50b099fec8a129f009b8b6f101 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 23 Feb 2021 12:52:57 +0100 Subject: [PATCH] Update entities --- src/CoreBundle/Entity/AccessUrl.php | 2 ++ .../Entity/CourseRelUserCatalogue.php | 7 ++--- src/CoreBundle/Entity/ExtraFieldValues.php | 12 ++------ src/CoreBundle/Entity/Session.php | 7 +---- src/CoreBundle/Entity/SessionRelUser.php | 11 ++------ src/CoreBundle/Entity/SysAnnouncement.php | 15 ++++------ src/CoreBundle/Entity/Usergroup.php | 2 +- .../TrackECourseAccessRepository.php | 12 ++------ src/CourseBundle/Entity/CAnnouncement.php | 7 ++--- src/CourseBundle/Entity/CAttendance.php | 10 ++----- src/CourseBundle/Entity/CForumForum.php | 2 +- src/CourseBundle/Entity/CForumPost.php | 5 +--- src/CourseBundle/Entity/CGroup.php | 2 +- src/CourseBundle/Entity/CGroupCategory.php | 20 ++++++------- src/CourseBundle/Entity/CLp.php | 10 +++---- src/CourseBundle/Entity/CQuizAnswer.php | 28 +++++-------------- src/CourseBundle/Entity/CThematicAdvance.php | 2 +- 17 files changed, 49 insertions(+), 105 deletions(-) diff --git a/src/CoreBundle/Entity/AccessUrl.php b/src/CoreBundle/Entity/AccessUrl.php index b3b13c79e1..20ae8b21f6 100644 --- a/src/CoreBundle/Entity/AccessUrl.php +++ b/src/CoreBundle/Entity/AccessUrl.php @@ -43,6 +43,8 @@ class AccessUrl extends AbstractResource implements ResourceInterface protected $courses; /** + * @var ArrayCollection|AccessUrlRelSession[] + * * @ORM\OneToMany(targetEntity="AccessUrlRelSession", mappedBy="url", cascade={"persist"}, orphanRemoval=true) */ protected $sessions; diff --git a/src/CoreBundle/Entity/CourseRelUserCatalogue.php b/src/CoreBundle/Entity/CourseRelUserCatalogue.php index 6b9b610d58..45feb48dd5 100644 --- a/src/CoreBundle/Entity/CourseRelUserCatalogue.php +++ b/src/CoreBundle/Entity/CourseRelUserCatalogue.php @@ -52,9 +52,6 @@ class CourseRelUserCatalogue */ protected $visible; - /** - * Constructor. - */ public function __construct() { } @@ -98,7 +95,7 @@ class CourseRelUserCatalogue /** * Set visible. * - * @param bool $visible + * @param int $visible */ public function setVisible($visible): self { @@ -110,7 +107,7 @@ class CourseRelUserCatalogue /** * Get visible. * - * @return bool + * @return int */ public function getVisible() { diff --git a/src/CoreBundle/Entity/ExtraFieldValues.php b/src/CoreBundle/Entity/ExtraFieldValues.php index 2794a6bbc8..81d02c127b 100644 --- a/src/CoreBundle/Entity/ExtraFieldValues.php +++ b/src/CoreBundle/Entity/ExtraFieldValues.php @@ -76,20 +76,12 @@ class ExtraFieldValues return $this; } - /** - * @return string - */ - public function getItemId() + public function getItemId(): int { return $this->itemId; } - /** - * @param string $itemId - * - * @return ExtraFieldValues - */ - public function setItemId($itemId) + public function setItemId(int $itemId): self { $this->itemId = $itemId; diff --git a/src/CoreBundle/Entity/Session.php b/src/CoreBundle/Entity/Session.php index 57ba197063..2b33fb70bb 100644 --- a/src/CoreBundle/Entity/Session.php +++ b/src/CoreBundle/Entity/Session.php @@ -348,12 +348,7 @@ class Session return $this->showDescription; } - /** - * @param string $showDescription - * - * @return $this - */ - public function setShowDescription($showDescription) + public function setShowDescription($showDescription): self { $this->showDescription = $showDescription; diff --git a/src/CoreBundle/Entity/SessionRelUser.php b/src/CoreBundle/Entity/SessionRelUser.php index 81c709df4e..bf1398d009 100644 --- a/src/CoreBundle/Entity/SessionRelUser.php +++ b/src/CoreBundle/Entity/SessionRelUser.php @@ -59,21 +59,17 @@ class SessionRelUser protected int $duration; /** - * @var int - * * @ORM\Column(name="moved_to", type="integer", nullable=true, unique=false) */ - protected $movedTo; + protected ?int $movedTo; /** - * @var int - * * @ORM\Column(name="moved_status", type="integer", nullable=true, unique=false) */ - protected $movedStatus; + protected ?int $movedStatus; /** - * @var \DateTime + * @var \DateTime|null * * @ORM\Column(name="moved_at", type="datetime", nullable=true, unique=false) */ @@ -91,7 +87,6 @@ class SessionRelUser $this->duration = 0; $this->movedTo = null; $this->movedStatus = null; - $this->movedAt = null; $this->registeredAt = new \DateTime('now', new \DateTimeZone('UTC')); } diff --git a/src/CoreBundle/Entity/SysAnnouncement.php b/src/CoreBundle/Entity/SysAnnouncement.php index f39ae2f317..f7ddba9497 100644 --- a/src/CoreBundle/Entity/SysAnnouncement.php +++ b/src/CoreBundle/Entity/SysAnnouncement.php @@ -126,17 +126,14 @@ class SysAnnouncement */ protected $promotionId; - /** - * SysAnnouncement constructor. - */ public function __construct() { - $this->visibleBoss = 0; - $this->visibleDrh = 0; - $this->visibleGuest = 0; - $this->visibleSessionAdmin = 0; - $this->visibleStudent = 0; - $this->visibleTeacher = 0; + $this->visibleBoss = false; + $this->visibleDrh = false; + $this->visibleGuest = false; + $this->visibleSessionAdmin = false; + $this->visibleStudent = false; + $this->visibleTeacher = false; $this->careerId = 0; $this->promotionId = 0; } diff --git a/src/CoreBundle/Entity/Usergroup.php b/src/CoreBundle/Entity/Usergroup.php index c908c82a83..5c35171809 100644 --- a/src/CoreBundle/Entity/Usergroup.php +++ b/src/CoreBundle/Entity/Usergroup.php @@ -85,7 +85,7 @@ class Usergroup extends AbstractResource implements ResourceInterface, ResourceI protected $allowMembersToLeaveGroup; /** - * @var UsergroupRelUser[] + * @var ArrayCollection|UsergroupRelUser[] * @ORM\OneToMany(targetEntity="UsergroupRelUser", mappedBy="usergroup", cascade={"persist"}, orphanRemoval=true) */ protected $users; diff --git a/src/CoreBundle/Repository/TrackECourseAccessRepository.php b/src/CoreBundle/Repository/TrackECourseAccessRepository.php index 69c730fd1c..265fed509a 100644 --- a/src/CoreBundle/Repository/TrackECourseAccessRepository.php +++ b/src/CoreBundle/Repository/TrackECourseAccessRepository.php @@ -16,9 +16,6 @@ use Doctrine\Persistence\ManagerRegistry; */ class TrackECourseAccessRepository extends ServiceEntityRepository { - /** - * TrackECourseAccessRepository constructor. - */ public function __construct(ManagerRegistry $registry) { parent::__construct($registry, TrackECourseAccess::class); @@ -26,15 +23,10 @@ class TrackECourseAccessRepository extends ServiceEntityRepository /** * Get the last registered access by an user. - * - * @param User $user The user - * - * @return TrackECourseAccess The access if exists. - * Otherwise return null */ - public function getLastAccessByUser(User $user) + public function getLastAccessByUser(User $user = null): ?TrackECourseAccess { - if (empty($user)) { + if (null === $user) { return null; } diff --git a/src/CourseBundle/Entity/CAnnouncement.php b/src/CourseBundle/Entity/CAnnouncement.php index 5f05ee6f2d..9f38e37d4b 100644 --- a/src/CourseBundle/Entity/CAnnouncement.php +++ b/src/CourseBundle/Entity/CAnnouncement.php @@ -61,7 +61,7 @@ class CAnnouncement extends AbstractResource implements ResourceInterface protected $emailSent; /** - * @var ArrayCollection|CAnnouncementAttachment[] + * @var ArrayCollection * * @ORM\OneToMany( * targetEntity="CAnnouncementAttachment", @@ -86,10 +86,7 @@ class CAnnouncement extends AbstractResource implements ResourceInterface return $this->attachments; } - /** - * @param CAnnouncementAttachment[] $attachments - */ - public function setAttachments(array $attachments): self + public function setAttachments($attachments): self { $this->attachments = $attachments; diff --git a/src/CourseBundle/Entity/CAttendance.php b/src/CourseBundle/Entity/CAttendance.php index 34077eb3af..d41ecd8f95 100644 --- a/src/CourseBundle/Entity/CAttendance.php +++ b/src/CourseBundle/Entity/CAttendance.php @@ -75,7 +75,7 @@ class CAttendance extends AbstractResource implements ResourceInterface protected int $locked; /** - * @var CAttendanceCalendar[] + * @var ArrayCollection|CAttendanceCalendar[] * * @ORM\OneToMany( * targetEntity="CAttendanceCalendar", mappedBy="attendance", cascade={"persist", "remove"}, orphanRemoval=true @@ -246,18 +246,12 @@ class CAttendance extends AbstractResource implements ResourceInterface return $this->iid; } - /** - * @return CAttendanceCalendar[]|ArrayCollection - */ public function getCalendars() { return $this->calendars; } - /** - * @param CAttendanceCalendar[] $calendars - */ - public function setCalendars(array $calendars): self + public function setCalendars($calendars): self { $this->calendars = $calendars; diff --git a/src/CourseBundle/Entity/CForumForum.php b/src/CourseBundle/Entity/CForumForum.php index 0a1ce27b38..32f7dc9387 100644 --- a/src/CourseBundle/Entity/CForumForum.php +++ b/src/CourseBundle/Entity/CForumForum.php @@ -215,7 +215,7 @@ class CForumForum extends AbstractResource implements ResourceInterface $this->locked = 0; $this->forumComment = ''; $this->forumImage = ''; - $this->forumOfGroup = 0; + $this->forumOfGroup = ''; $this->forumPosts = 0; $this->forumGroupPublicPrivate = ''; } diff --git a/src/CourseBundle/Entity/CForumPost.php b/src/CourseBundle/Entity/CForumPost.php index b94ae70e5f..7da3c52b54 100644 --- a/src/CourseBundle/Entity/CForumPost.php +++ b/src/CourseBundle/Entity/CForumPost.php @@ -94,7 +94,7 @@ class CForumPost extends AbstractResource implements ResourceInterface protected $postNotification; /** - * @var int + * @var int|null * * @ORM\Column(name="post_parent_id", type="integer", nullable=true) */ @@ -344,9 +344,6 @@ class CForumPost extends AbstractResource implements ResourceInterface return $this->iid; } - /** - * @return CForumAttachment[] - */ public function getAttachments() { return $this->attachments; diff --git a/src/CourseBundle/Entity/CGroup.php b/src/CourseBundle/Entity/CGroup.php index d42fc99e78..a11422c1fe 100644 --- a/src/CourseBundle/Entity/CGroup.php +++ b/src/CourseBundle/Entity/CGroup.php @@ -167,7 +167,7 @@ class CGroup extends AbstractResource implements ResourceInterface public function __construct() { - $this->status = 1; + $this->status = true; $this->members = new ArrayCollection(); $this->tutors = new ArrayCollection(); } diff --git a/src/CourseBundle/Entity/CGroupCategory.php b/src/CourseBundle/Entity/CGroupCategory.php index 62a2f10513..69daf17837 100644 --- a/src/CourseBundle/Entity/CGroupCategory.php +++ b/src/CourseBundle/Entity/CGroupCategory.php @@ -130,17 +130,17 @@ class CGroupCategory extends AbstractResource implements ResourceInterface { $this->maxStudent = 0; $this->description = ''; - $this->selfRegAllowed = 0; - $this->selfUnregAllowed = 0; + $this->selfRegAllowed = false; + $this->selfUnregAllowed = false; $this->groupsPerUser = 0; - $this->announcementsState = 1; - $this->calendarState = 1; - $this->documentAccess = 1; - $this->chatState = 1; - $this->docState = 1; - $this->forumState = 1; - $this->wikiState = 1; - $this->workState = 1; + $this->announcementsState = true; + $this->calendarState = true; + $this->documentAccess = 0; + $this->chatState = true; + $this->docState = true; + $this->forumState = true; + $this->wikiState = true; + $this->workState = true; } public function __toString(): string diff --git a/src/CourseBundle/Entity/CLp.php b/src/CourseBundle/Entity/CLp.php index 6e87a4a0d1..e040a702b7 100644 --- a/src/CourseBundle/Entity/CLp.php +++ b/src/CourseBundle/Entity/CLp.php @@ -269,7 +269,7 @@ class CLp extends AbstractResource implements ResourceInterface protected $accumulateWorkTime; /** - * @var CLpItem[] + * @var ArrayCollection|CLpItem[] * * @ORM\OneToMany(targetEntity="CLpItem", mappedBy="lp", cascade={"persist", "remove"}, orphanRemoval=true) */ @@ -305,15 +305,15 @@ class CLp extends AbstractResource implements ResourceInterface $this->defaultViewMod = 'embedded'; $this->description = ''; $this->displayOrder = 0; - $this->debug = 0; - $this->forceCommit = 0; - $this->hideTocFrame = 0; + $this->debug = false; + $this->forceCommit = false; + $this->hideTocFrame = false; $this->jsLib = ''; $this->maxAttempts = 0; $this->preventReinit = true; $this->path = ''; $this->prerequisite = 0; - $this->seriousgameMode = 0; + $this->seriousgameMode = false; $this->subscribeUsers = 0; $this->useMaxScore = 1; $this->theme = ''; diff --git a/src/CourseBundle/Entity/CQuizAnswer.php b/src/CourseBundle/Entity/CQuizAnswer.php index c790944d45..72d5beda8e 100644 --- a/src/CourseBundle/Entity/CQuizAnswer.php +++ b/src/CourseBundle/Entity/CQuizAnswer.php @@ -51,18 +51,14 @@ class CQuizAnswer protected string $answer; /** - * @var int - * * @ORM\Column(name="correct", type="integer", nullable=true) */ - protected $correct; + protected ?int $correct; /** - * @var string - * * @ORM\Column(name="comment", type="text", nullable=true) */ - protected $comment; + protected ?string $comment; /** * @var float @@ -72,39 +68,29 @@ class CQuizAnswer protected $ponderation; /** - * @var int - * * @ORM\Column(name="position", type="integer", nullable=false) */ - protected $position; + protected int $position; /** - * @var string - * * @ORM\Column(name="hotspot_coordinates", type="text", nullable=true) */ - protected $hotspotCoordinates; + protected ?string $hotspotCoordinates; /** - * @var string - * * @ORM\Column(name="hotspot_type", type="string", length=40, nullable=true) */ - protected $hotspotType; + protected ?string $hotspotType; /** - * @var string - * * @ORM\Column(name="destination", type="text", nullable=true) */ - protected $destination; + protected ?string $destination; /** - * @var string - * * @ORM\Column(name="answer_code", type="string", length=10, nullable=true) */ - protected $answerCode; + protected ?string $answerCode; public function __construct() { diff --git a/src/CourseBundle/Entity/CThematicAdvance.php b/src/CourseBundle/Entity/CThematicAdvance.php index 8a564e8f2c..78392f2fdc 100644 --- a/src/CourseBundle/Entity/CThematicAdvance.php +++ b/src/CourseBundle/Entity/CThematicAdvance.php @@ -78,7 +78,7 @@ class CThematicAdvance //extends AbstractResource implements ResourceInterface public function __construct() { - $this->doneAdvance = 0; + $this->doneAdvance = false; $this->duration = 1; }