From db6f319192cc7e3d79adaa3950cb93e260ad7048 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Sun, 23 May 2021 12:35:27 +0200 Subject: [PATCH] Forums: Replace CForumForum to CForum --- public/main/forum/editpost.php | 4 +- public/main/forum/editthread.php | 4 +- public/main/forum/forumfunction.inc.php | 44 +++++++++---------- public/main/forum/forumqualify.php | 4 +- public/main/forum/forumsearch.php | 4 +- public/main/forum/iframe_thread.php | 4 +- public/main/forum/newthread.php | 4 +- public/main/forum/reply.php | 4 +- public/main/forum/viewforum.php | 4 +- public/main/forum/viewthread.php | 4 +- public/main/inc/lib/groupmanager.lib.php | 2 +- public/main/lp/learnpathItem.class.php | 4 +- src/CoreBundle/Framework/Container.php | 6 +-- .../Schema/V200/Version20201215160445.php | 10 ++--- src/CoreBundle/Resources/config/tools.yml | 2 +- src/CoreBundle/Traits/ControllerTrait.php | 4 +- .../Entity/{CForumForum.php => CForum.php} | 2 +- src/CourseBundle/Entity/CForumCategory.php | 6 +-- src/CourseBundle/Entity/CForumPost.php | 8 ++-- src/CourseBundle/Entity/CForumThread.php | 8 ++-- src/CourseBundle/Entity/CLp.php | 8 ++-- ...rumRepository.php => CForumRepository.php} | 8 ++-- 22 files changed, 74 insertions(+), 74 deletions(-) rename src/CourseBundle/Entity/{CForumForum.php => CForum.php} (99%) rename src/CourseBundle/Repository/{CForumForumRepository.php => CForumRepository.php} (75%) diff --git a/public/main/forum/editpost.php b/public/main/forum/editpost.php index b308174e70..6dc51403ae 100644 --- a/public/main/forum/editpost.php +++ b/public/main/forum/editpost.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumThread; @@ -106,7 +106,7 @@ $forumId = isset($_GET['forum']) ? (int) $_GET['forum'] : 0; $userId = api_get_user_id(); $repo = Container::getForumRepository(); -/** @var CForumForum $forum */ +/** @var CForum $forum */ $forum = $repo->find($forumId); $repoThread = Container::getForumThreadRepository(); diff --git a/public/main/forum/editthread.php b/public/main/forum/editthread.php index 841690d666..c19d66f641 100644 --- a/public/main/forum/editthread.php +++ b/public/main/forum/editthread.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; /** * Edit a Forum Thread. @@ -82,7 +82,7 @@ $origin = api_get_origin(); $forumId = isset($_GET['forum']) ? (int) $_GET['forum'] : 0; $repo = Container::getForumRepository(); -/** @var CForumForum $forum */ +/** @var CForum $forum */ $forum = $repo->find($forumId); if (empty($forum)) { api_not_allowed(); diff --git a/public/main/forum/forumfunction.inc.php b/public/main/forum/forumfunction.inc.php index ee91579ce2..8a1219b8a9 100644 --- a/public/main/forum/forumfunction.inc.php +++ b/public/main/forum/forumfunction.inc.php @@ -8,7 +8,7 @@ use Chamilo\CoreBundle\Entity\User; use Chamilo\CoreBundle\Framework\Container; use Chamilo\CourseBundle\Entity\CForumAttachment; use Chamilo\CourseBundle\Entity\CForumCategory; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumNotification; use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumThread; @@ -267,7 +267,7 @@ function show_add_forumcategory_form($lp_id) } } -function forumForm(CForumForum $forum = null, $lp_id) +function forumForm(CForum $forum = null, $lp_id) { $_course = api_get_course_info(); // The header for the form @@ -779,10 +779,10 @@ function store_forum($values, $courseInfo = [], $returnId = false) $repo = Container::getForumRepository(); if (!isset($values['forum_id'])) { - $forum = new CForumForum(); + $forum = new CForum(); $forum->setForumOrder($new_max ?? null); } else { - /** @var CForumForum $forum */ + /** @var CForum $forum */ $forum = $repo->find($values['forum_id']); } @@ -1296,7 +1296,7 @@ function move_up_down($content, $direction, $id) if ('forum' === $content && $next_sort) { $repo = Container::getForumRepository(); - /** @var CForumForum $forum */ + /** @var CForum $forum */ $forum = $repo->find($id); $forum->setForumOrder($next_sort); $repo->update($forum); @@ -1344,7 +1344,7 @@ function get_forum_categories($courseId = 0, $sessionId = 0) * @param int $categoryId the id of the forum category * @param int $courseId Optional. The course ID * - * @return CForumForum[] containing all the information about the forums (regardless of their category) + * @return CForum[] containing all the information about the forums (regardless of their category) * * @author Patrick Cool , Ghent University * @@ -1374,7 +1374,7 @@ function get_forums_in_category($categoryId, $courseId = 0) * @param bool $includeGroupsForum * @param int $sessionId * - * @return CForumForum[] + * @return CForum[] */ function get_forums( $courseId = '', @@ -1854,7 +1854,7 @@ function getThreadInfo($threadId, $cId) * @return array containing all the information about the posts of a given thread */ function getPosts( - CForumForum $forum, + CForum $forum, $threadId, $orderDirection = 'ASC', $recursive = false, @@ -2312,7 +2312,7 @@ function updateThread($values) } function saveThread( - CForumForum $forum, + CForum $forum, array $values, array $courseInfo = [], $showMessage = true, @@ -2548,7 +2548,7 @@ function saveThread( * * @return FormValidator */ -function show_add_post_form(CForumForum $forum, CForumThread $thread, CForumPost $post = null, $action, $form_values, $showPreview = true) +function show_add_post_form(CForum $forum, CForumThread $thread, CForumPost $post = null, $action, $form_values, $showPreview = true) { $_user = api_get_user_info(); $action = isset($action) ? Security::remove_XSS($action) : ''; @@ -2814,7 +2814,7 @@ function show_add_post_form(CForumForum $forum, CForumThread $thread, CForumPost } } -function newThread(CForumForum $forum, $form_values = '', $showPreview = true) +function newThread(CForum $forum, $form_values = '', $showPreview = true) { $_user = api_get_user_info(); $forumId = $forum->getIid(); @@ -3344,7 +3344,7 @@ function current_qualify_of_thread($threadId, $sessionId, $userId) * * @return int post id */ -function store_reply(CForumForum $forum, CForumThread $thread, $values, $courseId = 0, $userId = 0) +function store_reply(CForum $forum, CForumThread $thread, $values, $courseId = 0, $userId = 0) { $courseId = !empty($courseId) ? $courseId : api_get_course_int_id(); $_course = api_get_course_info_by_id($courseId); @@ -3496,7 +3496,7 @@ function store_reply(CForumForum $forum, CForumThread $thread, $values, $courseI * * @param CForumPost $post contains all the information about the current post * @param CForumThread $thread contains all the information about the current thread - * @param CForumForum $forum contains all info about the current forum (to check if attachments are allowed) + * @param CForum $forum contains all info about the current forum (to check if attachments are allowed) * @param array $form_values contains the default values to fill the form * * @author Patrick Cool , Ghent University @@ -3658,7 +3658,7 @@ function show_edit_post_form( * * @version february 2006, dokeos 1.8 */ -function store_edit_post(CForumForum $forum, $values) +function store_edit_post(CForum $forum, $values) { $logInfo = [ 'tool' => TOOL_FORUM, @@ -3940,7 +3940,7 @@ function get_unaproved_messages($forum_id) * This function sends the notification mails to everybody who stated that they wanted to be informed when a new post * was added to a given thread. */ -function send_notification_mails(CForumForum $forum, CForumThread $thread, $reply_info) +function send_notification_mails(CForum $forum, CForumThread $thread, $reply_info) { $courseEntity = api_get_course_entity(); $courseId = $courseEntity->getId(); @@ -4093,7 +4093,7 @@ function handle_mail_cue($content, $id) /** * This function sends the mails for the mail notification. */ -function send_mail($userInfo, CForumForum $forum, CForumThread $thread, CForumPost $postInfo = null) +function send_mail($userInfo, CForum $forum, CForumThread $thread, CForumPost $postInfo = null) { if (empty($userInfo) || empty($forum) || empty($thread)) { return false; @@ -5003,7 +5003,7 @@ function delete_attachment($postId, $attachmentId) * * @param array $groupInfo the id of the group we need the fora of (see forum.forum_of_group) * - * @return CForumForum[] + * @return CForum[] * * @todo this is basically the same code as the get_forums function. Consider merging the two. */ @@ -5294,7 +5294,7 @@ function get_notifications($content, $id) * * @since May 2008, dokeos 1.8.5 */ -function send_notifications(CForumForum $forum, CForumThread $thread, $post_id = 0) +function send_notifications(CForum $forum, CForumThread $thread, $post_id = 0) { if (!$forum) { return false; @@ -5679,7 +5679,7 @@ function getForumCreatedByUser($userId, $courseInfo, $sessionId) $forumList = []; if (!empty($items)) { - /** @var CForumForum $forum */ + /** @var CForum $forum */ foreach ($items as $forum) { $forumList[] = [ $forum->getForumTitle(), @@ -6105,7 +6105,7 @@ function getForumCategoryByTitle($title, $courseId, $sessionId = 0) return $resultData;*/ } -function getPostStatus(CForumForum $forum, array $row, bool $addWrapper = true): string +function getPostStatus(CForum $forum, array $row, bool $addWrapper = true): string { $statusIcon = ''; if ($forum->isModerated()) { @@ -6174,7 +6174,7 @@ function getPostStatus(CForumForum $forum, array $row, bool $addWrapper = true): } /** - * @param CForumForum $forum + * @param CForum $forum * @param int $threadId * @param int $status */ @@ -6200,7 +6200,7 @@ function getCountPostsWithStatus($status, $forum, $threadId = null) } /** - * @param CForumForum $forum + * @param CForum $forum * @param CForumPost $post * * @return bool diff --git a/public/main/forum/forumqualify.php b/public/main/forum/forumqualify.php index 1f4089b8ad..09d4ab4d47 100644 --- a/public/main/forum/forumqualify.php +++ b/public/main/forum/forumqualify.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumThread; /** @@ -83,7 +83,7 @@ $allowed_to_edit = api_is_allowed_to_edit(null, true); $repo = Container::getForumRepository(); $repoThread = Container::getForumThreadRepository(); -/** @var CForumForum $forumEntity */ +/** @var CForum $forumEntity */ $forumEntity = $repo->find($forumId); /** @var CForumThread $threadEntity */ $threadEntity = $repoThread->find($threadId); diff --git a/public/main/forum/forumsearch.php b/public/main/forum/forumsearch.php index eb3dbdbe51..7e3d183c9c 100644 --- a/public/main/forum/forumsearch.php +++ b/public/main/forum/forumsearch.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; /** * These files are a complete rework of the forum. The database structure is @@ -86,7 +86,7 @@ $(function () { $forumId = isset($_GET['forum']) ? (int) ($_GET['forum']) : 0; $repo = Container::getForumRepository(); -/** @var CForumForum $forumEntity */ +/** @var CForum $forumEntity */ $forumEntity = $repo->find($forumId); // Are we in a lp ? diff --git a/public/main/forum/iframe_thread.php b/public/main/forum/iframe_thread.php index 4aa5c559ac..cf5b5adac1 100644 --- a/public/main/forum/iframe_thread.php +++ b/public/main/forum/iframe_thread.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumThread; /** @@ -36,7 +36,7 @@ $threadId = isset($_GET['thread']) ? (int) $_GET['thread'] : 0; $repo = Container::getForumRepository(); $forumEntity = null; if (!empty($forumId)) { - /** @var CForumForum $forumEntity */ + /** @var CForum $forumEntity */ $forumEntity = $repo->find($forumId); } diff --git a/public/main/forum/newthread.php b/public/main/forum/newthread.php index cbcb3f90d6..b169133795 100644 --- a/public/main/forum/newthread.php +++ b/public/main/forum/newthread.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; /** * These files are a complete rework of the forum. The database structure is @@ -95,7 +95,7 @@ $repo = Container::getForumRepository(); $forumEntity = null; if (!empty($forumId)) { - /** @var CForumForum $forumEntity */ + /** @var CForum $forumEntity */ $forumEntity = $repo->find($forumId); } diff --git a/public/main/forum/reply.php b/public/main/forum/reply.php index 196f43ba49..2b7a0abaf4 100644 --- a/public/main/forum/reply.php +++ b/public/main/forum/reply.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumThread; /** @@ -86,7 +86,7 @@ $forumId = isset($_GET['forum']) ? (int) $_GET['forum'] : 0; $threadId = isset($_GET['thread']) ? (int) $_GET['thread'] : 0; $repo = Container::getForumRepository(); -/** @var CForumForum $forum */ +/** @var CForum $forum */ $forum = $repo->find($forumId); if (empty($forum)) { diff --git a/public/main/forum/viewforum.php b/public/main/forum/viewforum.php index 09ec2053fc..27e07ad3a3 100644 --- a/public/main/forum/viewforum.php +++ b/public/main/forum/viewforum.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumPost; require_once __DIR__.'/../inc/global.inc.php'; @@ -74,7 +74,7 @@ $courseId = api_get_course_int_id(); $isAllowedToEdit = api_is_allowed_to_edit(false, true) && api_is_allowed_to_session_edit(false, true); $repo = Container::getForumRepository(); -/** @var CForumForum $forumEntity */ +/** @var CForum $forumEntity */ $forumEntity = $repo->find($forumId); $courseEntity = api_get_course_entity(api_get_course_int_id()); $sessionEntity = api_get_session_entity(api_get_session_id()); diff --git a/public/main/forum/viewthread.php b/public/main/forum/viewthread.php index 4461f338a1..452bf828c9 100644 --- a/public/main/forum/viewthread.php +++ b/public/main/forum/viewthread.php @@ -4,7 +4,7 @@ use Chamilo\CoreBundle\Framework\Container; use Chamilo\CourseBundle\Entity\CForumAttachment; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumThread; @@ -81,7 +81,7 @@ $threadId = isset($_GET['thread']) ? (int) $_GET['thread'] : 0; $repo = Container::getForumRepository(); $forumEntity = null; if (!empty($forumId)) { - /** @var CForumForum $forumEntity */ + /** @var CForum $forumEntity */ $forumEntity = $repo->find($forumId); } diff --git a/public/main/inc/lib/groupmanager.lib.php b/public/main/inc/lib/groupmanager.lib.php index d57ebd07ba..5280f49f1d 100644 --- a/public/main/inc/lib/groupmanager.lib.php +++ b/public/main/inc/lib/groupmanager.lib.php @@ -457,7 +457,7 @@ class GroupManager $em ->createQuery( - 'DELETE FROM ChamiloCourseBundle:CForumForum f WHERE f.forumOfGroup = :group' + 'DELETE FROM ChamiloCourseBundle:CForum f WHERE f.forumOfGroup = :group' ) ->execute(['group' => $groupIid]); diff --git a/public/main/lp/learnpathItem.class.php b/public/main/lp/learnpathItem.class.php index b27f8abfef..ba511b1308 100644 --- a/public/main/lp/learnpathItem.class.php +++ b/public/main/lp/learnpathItem.class.php @@ -3,7 +3,7 @@ /* For licensing terms, see /license.txt */ use Chamilo\CoreBundle\Framework\Container; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumThread; use Chamilo\CourseBundle\Entity\CLp; use Chamilo\CourseBundle\Entity\CLpItem; @@ -4325,7 +4325,7 @@ class learnpathItem * * @return int The forum thread if was created. Otherwise return false */ - public function createForumThread(CForumForum $forum) + public function createForumThread(CForum $forum) { $em = Database::getManager(); $threadRepo = Container::getForumThreadRepository(); diff --git a/src/CoreBundle/Framework/Container.php b/src/CoreBundle/Framework/Container.php index 65c88b062d..8a9f398ad5 100644 --- a/src/CoreBundle/Framework/Container.php +++ b/src/CoreBundle/Framework/Container.php @@ -32,7 +32,7 @@ use Chamilo\CourseBundle\Repository\CDocumentRepository; use Chamilo\CourseBundle\Repository\CExerciseCategoryRepository; use Chamilo\CourseBundle\Repository\CForumAttachmentRepository; use Chamilo\CourseBundle\Repository\CForumCategoryRepository; -use Chamilo\CourseBundle\Repository\CForumForumRepository; +use Chamilo\CourseBundle\Repository\CForumRepository; use Chamilo\CourseBundle\Repository\CForumPostRepository; use Chamilo\CourseBundle\Repository\CForumThreadRepository; use Chamilo\CourseBundle\Repository\CGlossaryRepository; @@ -312,9 +312,9 @@ class Container return self::$container->get(CExerciseCategoryRepository::class); } - public static function getForumRepository(): CForumForumRepository + public static function getForumRepository(): CForumRepository { - return self::$container->get(CForumForumRepository::class); + return self::$container->get(CForumRepository::class); } public static function getForumCategoryRepository(): CForumCategoryRepository diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php b/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php index 1628d81a82..c69df85161 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php @@ -12,12 +12,12 @@ use Chamilo\CoreBundle\Repository\Node\CourseRepository; use Chamilo\CoreBundle\Repository\Node\UserRepository; use Chamilo\CoreBundle\Repository\SessionRepository; use Chamilo\CourseBundle\Entity\CForumCategory; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Chamilo\CourseBundle\Entity\CForumPost; use Chamilo\CourseBundle\Entity\CForumThread; use Chamilo\CourseBundle\Repository\CForumAttachmentRepository; use Chamilo\CourseBundle\Repository\CForumCategoryRepository; -use Chamilo\CourseBundle\Repository\CForumForumRepository; +use Chamilo\CourseBundle\Repository\CForumRepository; use Chamilo\CourseBundle\Repository\CForumPostRepository; use Chamilo\CourseBundle\Repository\CForumThreadRepository; use Chamilo\CourseBundle\Repository\CGroupRepository; @@ -41,7 +41,7 @@ final class Version20201215160445 extends AbstractMigrationChamilo $connection = $em->getConnection(); $forumCategoryRepo = $container->get(CForumCategoryRepository::class); - $forumRepo = $container->get(CForumForumRepository::class); + $forumRepo = $container->get(CForumRepository::class); $forumAttachmentRepo = $container->get(CForumAttachmentRepository::class); $forumThreadRepo = $container->get(CForumThreadRepository::class); $forumPostRepo = $container->get(CForumPostRepository::class); @@ -102,7 +102,7 @@ final class Version20201215160445 extends AbstractMigrationChamilo $items = $result->fetchAllAssociative(); foreach ($items as $itemData) { $id = $itemData['iid']; - /** @var CForumForum $resource */ + /** @var CForum $resource */ $resource = $forumRepo->find($id); if ($resource->hasResourceNode()) { continue; @@ -160,7 +160,7 @@ final class Version20201215160445 extends AbstractMigrationChamilo } $course = $courseRepo->find($courseId); - /** @var CForumForum $resource */ + /** @var CForum $resource */ $forum = $forumRepo->find($forumId); $result = $this->fixItemProperty( diff --git a/src/CoreBundle/Resources/config/tools.yml b/src/CoreBundle/Resources/config/tools.yml index d7277ed110..e15896f03b 100644 --- a/src/CoreBundle/Resources/config/tools.yml +++ b/src/CoreBundle/Resources/config/tools.yml @@ -222,7 +222,7 @@ services: - '@chamilo_course.settings.forum' - forums: - repository: Chamilo\CourseBundle\Repository\CForumForumRepository + repository: Chamilo\CourseBundle\Repository\CForumRepository forum_attachments: repository: Chamilo\CourseBundle\Repository\CForumAttachmentRepository forum_categories: diff --git a/src/CoreBundle/Traits/ControllerTrait.php b/src/CoreBundle/Traits/ControllerTrait.php index 59272d3bf2..c5504200e3 100644 --- a/src/CoreBundle/Traits/ControllerTrait.php +++ b/src/CoreBundle/Traits/ControllerTrait.php @@ -19,7 +19,7 @@ use Chamilo\CourseBundle\Repository\CBlogRepository; use Chamilo\CourseBundle\Repository\CCalendarEventAttachmentRepository; use Chamilo\CourseBundle\Repository\CDocumentRepository; use Chamilo\CourseBundle\Repository\CForumAttachmentRepository; -use Chamilo\CourseBundle\Repository\CForumForumRepository; +use Chamilo\CourseBundle\Repository\CForumRepository; use Chamilo\CourseBundle\Repository\CLpCategoryRepository; use Chamilo\CourseBundle\Repository\CLpRepository; use Chamilo\CourseBundle\Repository\CQuizQuestionCategoryRepository; @@ -66,7 +66,7 @@ trait ControllerTrait $services[] = CBlogRepository::class; $services[] = CCalendarEventAttachmentRepository::class; $services[] = CDocumentRepository::class; - $services[] = CForumForumRepository::class; + $services[] = CForumRepository::class; $services[] = CForumAttachmentRepository::class; $services[] = CLpRepository::class; $services[] = CLpCategoryRepository::class; diff --git a/src/CourseBundle/Entity/CForumForum.php b/src/CourseBundle/Entity/CForum.php similarity index 99% rename from src/CourseBundle/Entity/CForumForum.php rename to src/CourseBundle/Entity/CForum.php index 636f695888..d214617a6a 100644 --- a/src/CourseBundle/Entity/CForumForum.php +++ b/src/CourseBundle/Entity/CForum.php @@ -25,7 +25,7 @@ use Symfony\Component\Validator\Constraints as Assert; * ) * @ORM\Entity */ -class CForumForum extends AbstractResource implements ResourceInterface +class CForum extends AbstractResource implements ResourceInterface { /** * @ORM\Column(name="iid", type="integer") diff --git a/src/CourseBundle/Entity/CForumCategory.php b/src/CourseBundle/Entity/CForumCategory.php index 0e1ac756a0..9a063d4685 100644 --- a/src/CourseBundle/Entity/CForumCategory.php +++ b/src/CourseBundle/Entity/CForumCategory.php @@ -55,9 +55,9 @@ class CForumCategory extends AbstractResource implements ResourceInterface protected int $locked; /** - * @var Collection|CForumForum[] + * @var Collection|CForum[] * - * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", mappedBy="forumCategory") + * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CForum", mappedBy="forumCategory") */ protected Collection $forums; @@ -149,7 +149,7 @@ class CForumCategory extends AbstractResource implements ResourceInterface /** * Get forums. * - * @return Collection|CForumForum[] + * @return Collection|CForum[] */ public function getForums() { diff --git a/src/CourseBundle/Entity/CForumPost.php b/src/CourseBundle/Entity/CForumPost.php index b239a6ccfa..eb17578c13 100644 --- a/src/CourseBundle/Entity/CForumPost.php +++ b/src/CourseBundle/Entity/CForumPost.php @@ -79,10 +79,10 @@ class CForumPost extends AbstractResource implements ResourceInterface protected ?CForumThread $thread = null; /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", inversedBy="posts") + * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForum", inversedBy="posts") * @ORM\JoinColumn(name="forum_id", referencedColumnName="iid", nullable=true, onDelete="SET NULL") */ - protected ?CForumForum $forum = null; + protected ?CForum $forum = null; /** * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") @@ -246,12 +246,12 @@ class CForumPost extends AbstractResource implements ResourceInterface $this->attachments->removeElement($attachment); } - public function getForum(): ?CForumForum + public function getForum(): ?CForum { return $this->forum; } - public function setForum(?CForumForum $forum): self + public function setForum(?CForum $forum): self { $this->forum = $forum; diff --git a/src/CourseBundle/Entity/CForumThread.php b/src/CourseBundle/Entity/CForumThread.php index 550eedb002..a9360d17df 100644 --- a/src/CourseBundle/Entity/CForumThread.php +++ b/src/CourseBundle/Entity/CForumThread.php @@ -42,10 +42,10 @@ class CForumThread extends AbstractResource implements ResourceInterface protected string $threadTitle; /** - * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", inversedBy="threads") + * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForum", inversedBy="threads") * @ORM\JoinColumn(name="forum_id", referencedColumnName="iid", nullable=true, onDelete="SET NULL") */ - protected ?CForumForum $forum = null; + protected ?CForum $forum = null; /** * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User") @@ -171,7 +171,7 @@ class CForumThread extends AbstractResource implements ResourceInterface return $this->threadTitle; } - public function setForum(CForumForum $forum = null): self + public function setForum(CForum $forum = null): self { $this->forum = $forum; @@ -181,7 +181,7 @@ class CForumThread extends AbstractResource implements ResourceInterface /** * Get forumId. * - * @return null|CForumForum + * @return null|CForum */ public function getForum() { diff --git a/src/CourseBundle/Entity/CLp.php b/src/CourseBundle/Entity/CLp.php index dbe6256df6..ebb7b98f51 100644 --- a/src/CourseBundle/Entity/CLp.php +++ b/src/CourseBundle/Entity/CLp.php @@ -207,9 +207,9 @@ class CLp extends AbstractResource implements ResourceInterface protected Collection $items; /** - * @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumForum", mappedBy="lp") + * @ORM\OneToOne(targetEntity="Chamilo\CourseBundle\Entity\CForum", mappedBy="lp") */ - protected ?CForumForum $forum = null; + protected ?CForum $forum = null; /** * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Asset", cascade={"persist", "remove"}) @@ -757,7 +757,7 @@ class CLp extends AbstractResource implements ResourceInterface return $this; } - public function getForum(): ?CForumForum + public function getForum(): ?CForum { return $this->forum; } @@ -767,7 +767,7 @@ class CLp extends AbstractResource implements ResourceInterface return null !== $this->forum; } - public function setForum(CForumForum $forum): self + public function setForum(CForum $forum): self { $this->forum = $forum; diff --git a/src/CourseBundle/Repository/CForumForumRepository.php b/src/CourseBundle/Repository/CForumRepository.php similarity index 75% rename from src/CourseBundle/Repository/CForumForumRepository.php rename to src/CourseBundle/Repository/CForumRepository.php index f77bc00351..162cee5b43 100644 --- a/src/CourseBundle/Repository/CForumForumRepository.php +++ b/src/CourseBundle/Repository/CForumRepository.php @@ -8,19 +8,19 @@ namespace Chamilo\CourseBundle\Repository; use Chamilo\CoreBundle\Entity\ResourceInterface; use Chamilo\CoreBundle\Repository\ResourceRepository; -use Chamilo\CourseBundle\Entity\CForumForum; +use Chamilo\CourseBundle\Entity\CForum; use Doctrine\Persistence\ManagerRegistry; -final class CForumForumRepository extends ResourceRepository +final class CForumRepository extends ResourceRepository { public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, CForumForum::class); + parent::__construct($registry, CForum::class); } public function delete(ResourceInterface $resource): void { - /** @var CForumForum $resource */ + /** @var CForum $resource */ $threads = $resource->getThreads(); if (!empty($threads)) { foreach ($threads as $thread) {