Forums: Replace CForumForum to CForum

pull/3890/head
Julio Montoya 4 years ago
parent b8e3951478
commit db6f319192
  1. 4
      public/main/forum/editpost.php
  2. 4
      public/main/forum/editthread.php
  3. 44
      public/main/forum/forumfunction.inc.php
  4. 4
      public/main/forum/forumqualify.php
  5. 4
      public/main/forum/forumsearch.php
  6. 4
      public/main/forum/iframe_thread.php
  7. 4
      public/main/forum/newthread.php
  8. 4
      public/main/forum/reply.php
  9. 4
      public/main/forum/viewforum.php
  10. 4
      public/main/forum/viewthread.php
  11. 2
      public/main/inc/lib/groupmanager.lib.php
  12. 4
      public/main/lp/learnpathItem.class.php
  13. 6
      src/CoreBundle/Framework/Container.php
  14. 10
      src/CoreBundle/Migrations/Schema/V200/Version20201215160445.php
  15. 2
      src/CoreBundle/Resources/config/tools.yml
  16. 4
      src/CoreBundle/Traits/ControllerTrait.php
  17. 2
      src/CourseBundle/Entity/CForum.php
  18. 6
      src/CourseBundle/Entity/CForumCategory.php
  19. 8
      src/CourseBundle/Entity/CForumPost.php
  20. 8
      src/CourseBundle/Entity/CForumThread.php
  21. 8
      src/CourseBundle/Entity/CLp.php
  22. 8
      src/CourseBundle/Repository/CForumRepository.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();

@ -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();

@ -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 <patrick.cool@UGent.be>, 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 <patrick.cool@UGent.be>, 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

@ -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);

@ -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 ?

@ -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);
}

@ -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);
}

@ -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)) {

@ -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());

@ -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);
}

@ -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]);

@ -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();

@ -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

@ -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(

@ -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:

@ -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;

@ -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")

@ -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()
{

@ -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;

@ -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()
{

@ -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;

@ -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) {
Loading…
Cancel
Save