Skip to content

Commit 5f87239

Browse files
committed
Internal: Avoid short namespace aliases such as "ChamiloCoreBundle" and "ChamiloCourseBundle"
1 parent b52c5fa commit 5f87239

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+169
-113
lines changed

public/main/admin/settings.lib.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* For licensing terms, see /license.txt */
33

44
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
5+
use Chamilo\CoreBundle\Entity\Course;
56
use Chamilo\CoreBundle\Entity\Plugin as PluginEntity;
67
use Chamilo\CoreBundle\Entity\SystemTemplate;
78
use ChamiloSession as Session;
@@ -1333,7 +1334,7 @@ function generateSettingsForm($settings, $settings_by_access_list)
13331334
$courseSelectOptions = [];
13341335

13351336
if (!empty($row['selected_value'])) {
1336-
$course = $em->find('ChamiloCoreBundle:Course', $row['selected_value']);
1337+
$course = $em->find(Course::class, $row['selected_value']);
13371338

13381339
$courseSelectOptions[$course->getId()] = $course->getTitle();
13391340
}

public/main/cron/import_csv.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/* For licensing terms, see /license.txt */
33

4+
use Chamilo\CoreBundle\Entity\Course;
45
use Chamilo\CoreBundle\Entity\UserAuthSource;
56
use Chamilo\CourseBundle\Entity\CCalendarEvent;
67
use Chamilo\CourseBundle\Entity\CItemProperty;
@@ -1270,7 +1271,7 @@ private function importCalendarStatic($file, $moveFile = true)
12701271
/* Check if event changed of course code */
12711272
if (!empty($item) && isset($item['item_id']) && !empty($item['item_id'])) {
12721273
/** @var CCalendarEvent $calendarEvent */
1273-
$calendarEvent = $em->getRepository('ChamiloCourseBundle:CCalendarEvent')->find($item['item_id']);
1274+
$calendarEvent = $em->getRepository(CCalendarEvent::class)->find($item['item_id']);
12741275
}
12751276

12761277
if ($calendarEvent) {
@@ -1288,7 +1289,7 @@ private function importCalendarStatic($file, $moveFile = true)
12881289
];
12891290
/** @var CItemProperty $itemProperty */
12901291
$itemProperty = $em->getRepository('ChamiloCourseBundle:CItemProperty')->findOneBy($criteria);
1291-
$courseEntity = $em->getRepository('ChamiloCoreBundle:Course')->find($courseInfo['real_id']);
1292+
$courseEntity = $em->getRepository(Course::class)->find($courseInfo['real_id']);
12921293
if ($itemProperty && $courseEntity) {
12931294
$itemProperty->setCourse($courseEntity);
12941295
$em->persist($itemProperty);

public/main/inc/lib/CoursesAndSessionsCatalog.class.php

+26-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
<?php
22
/* For licensing terms, see /license.txt */
33

4+
use Chamilo\CoreBundle\Entity\AccessUrlRelSession;
45
use Chamilo\CoreBundle\Entity\ExtraField;
6+
use Chamilo\CoreBundle\Entity\ExtraFieldRelTag;
7+
use Chamilo\CoreBundle\Entity\ExtraFieldValues;
8+
use Chamilo\CoreBundle\Entity\SequenceResource;
9+
use Chamilo\CoreBundle\Entity\Session;
10+
use Chamilo\CoreBundle\Entity\SessionRelCourse;
11+
use Chamilo\CoreBundle\Entity\Tag;
512
use Chamilo\CoreBundle\Entity\User;
613
use Chamilo\CoreBundle\Framework\Container;
714
use Chamilo\CoreBundle\Event\AbstractEvent;
@@ -732,14 +739,14 @@ public static function browseSessions($date = null, $limit = [], $returnQueryBui
732739

733740
$qb = $qb
734741
->select('s')
735-
->from('ChamiloCoreBundle:Session', 's')
742+
->from(Session::class, 's')
736743
->where(
737744
$qb->expr()->in(
738745
's',
739746
$qb2
740747
->select('s2')
741-
->from('ChamiloCoreBundle:AccessUrlRelSession', 'url')
742-
->join('ChamiloCoreBundle:Session', 's2')
748+
->from(AccessUrlRelSession::class, 'url')
749+
->join(Session::class, 's2')
743750
->where(
744751
$qb->expr()->eq('url.sessionId ', 's2.id')
745752
)->andWhere(
@@ -813,8 +820,8 @@ public static function hideFromSessionCatalogCondition($qb)
813820
's',
814821
$qb3
815822
->select('s3')
816-
->from('ChamiloCoreBundle:ExtraFieldValues', 'fv')
817-
->innerJoin('ChamiloCoreBundle:Session', 's3', Join::WITH, 'fv.itemId = s3.id')
823+
->from(ExtraFieldValues::class, 'fv')
824+
->innerJoin(Session::class, 's3', Join::WITH, 'fv.itemId = s3.id')
818825
->where(
819826
$qb->expr()->eq('fv.field', $extraFieldInfo['id'])
820827
)->andWhere(
@@ -845,33 +852,33 @@ public static function browseSessionsByTags($termTag, array $limit, $getCount =
845852

846853
$qb->select('s')
847854
->distinct()
848-
->from('ChamiloCoreBundle:Session', 's')
855+
->from(Session::class, 's')
849856
->innerJoin(
850-
'ChamiloCoreBundle:SessionRelCourse',
857+
SessionRelCourse::class,
851858
'src',
852859
Join::WITH,
853860
's.id = src.session'
854861
)
855862
->innerJoin(
856-
'ChamiloCoreBundle:AccessUrlRelSession',
863+
AccessUrlRelSession::class,
857864
'url',
858865
Join::WITH,
859866
'url.sessionId = s.id'
860867
)
861868
->innerJoin(
862-
'ChamiloCoreBundle:ExtraFieldRelTag',
869+
ExtraFieldRelTag::class,
863870
'frt',
864871
Join::WITH,
865872
'src.course = frt.itemId'
866873
)
867874
->innerJoin(
868-
'ChamiloCoreBundle:Tag',
875+
Tag::class,
869876
't',
870877
Join::WITH,
871878
'frt.tagId = t.id'
872879
)
873880
->innerJoin(
874-
'ChamiloCoreBundle:ExtraField',
881+
ExtraField::class,
875882
'f',
876883
Join::WITH,
877884
'frt.fieldId = f.id'
@@ -921,15 +928,15 @@ public static function getSessionsByName($keyword, array $limit, $getCount = fal
921928

922929
$qb->select('s')
923930
->distinct()
924-
->from('ChamiloCoreBundle:Session', 's')
931+
->from(Session::class, 's')
925932
->innerJoin(
926-
'ChamiloCoreBundle:SessionRelCourse',
933+
SessionRelCourse::class,
927934
'src',
928935
Join::WITH,
929936
's.id = src.session'
930937
)
931938
->innerJoin(
932-
'ChamiloCoreBundle:AccessUrlRelSession',
939+
AccessUrlRelSession::class,
933940
'url',
934941
Join::WITH,
935942
'url.sessionId = s.id'
@@ -1563,16 +1570,16 @@ public static function getFormattedSessionsBlock(array $sessions)
15631570
$userId = api_get_user_id();
15641571
$sessionsBlocks = [];
15651572
$entityManager = Database::getManager();
1566-
$sessionRelCourseRepo = $entityManager->getRepository('ChamiloCoreBundle:SessionRelCourse');
1567-
$extraFieldRepo = $entityManager->getRepository('ChamiloCoreBundle:ExtraField');
1573+
$sessionRelCourseRepo = $entityManager->getRepository(SessionRelCourse::class);
1574+
$extraFieldRepo = $entityManager->getRepository(ExtraField::class);
15681575
$tagRepo = Container::getTagRepository();
15691576

15701577
$tagsField = $extraFieldRepo->findOneBy([
1571-
'itemType' => Chamilo\CoreBundle\Entity\ExtraField::COURSE_FIELD_TYPE,
1578+
'itemType' => ExtraField::COURSE_FIELD_TYPE,
15721579
'variable' => 'tags',
15731580
]);
15741581

1575-
/** @var \Chamilo\CoreBundle\Entity\Session $session */
1582+
/** @var Session $session */
15761583
foreach ($sessions as $session) {
15771584
$sessionDates = SessionManager::parseSessionDates([
15781585
'display_start_date' => $session->getDisplayStartDate(),
@@ -1610,7 +1617,7 @@ public static function getFormattedSessionsBlock(array $sessions)
16101617
}
16111618

16121619
/** @var SequenceResourceRepository $repo */
1613-
$repo = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
1620+
$repo = $entityManager->getRepository(SequenceResource::class);
16141621
$sequences = $repo->getRequirementsAndDependenciesWithinSequences(
16151622
$session->getId(),
16161623
SequenceResource::SESSION_TYPE

public/main/inc/lib/document.lib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ public static function is_visible(
10291029

10301030
$em = Database::getManager();
10311031

1032-
$repo = $em->getRepository('ChamiloCourseBundle:CDocument');
1032+
$repo = $em->getRepository(CDocument::class);
10331033
/** @var \Chamilo\CourseBundle\Entity\CDocument $document */
10341034
$document = $repo->find($row['iid']);
10351035
if (ResourceLink::VISIBILITY_PUBLISHED === $document->getVisibility()) {

public/main/inc/lib/extra_field_value.lib.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ public function getAllValuesForAnItem($itemId, $visibleToSelf = null, $visibleTo
11391139
$em = Database::getManager();
11401140
$qb = $em->createQueryBuilder();
11411141
$qb = $qb->select('fv')
1142-
->from('ChamiloCoreBundle:ExtraFieldValues', 'fv')
1142+
->from(ExtraFieldValues::class, 'fv')
11431143
->join('fv.field', 'f')
11441144
->where(
11451145
$qb->expr()->eq('fv.itemId', ':item')

public/main/inc/lib/javascript/chat/video.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
/* For licensing terms, see /license.txt */
33

4+
use Chamilo\CoreBundle\Entity\ChatVideo;
5+
46
require_once __DIR__.'/../../../global.inc.php';
57

68
if (api_is_anonymous()) {
@@ -11,7 +13,7 @@
1113

1214
$entityManager = Database::getManager();
1315

14-
$chatVideo = $entityManager->find('ChamiloCoreBundle:ChatVideo', $roomId);
16+
$chatVideo = $entityManager->find(ChatVideo::class, $roomId);
1517

1618
if (!$chatVideo) {
1719
header('Location: '.api_get_path(WEB_PATH));

public/main/inc/lib/search/tool_processors/quiz_processor.class.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
/* For licensing terms, see /license.txt */
33

4+
use Chamilo\CourseBundle\Entity\CQuiz;
5+
46
/**
57
* Process exercises before pass it to search listing scripts.
68
*/
@@ -107,7 +109,7 @@ private function get_information($courseCode, $exercise_id)
107109
if (!empty($course_information)) {
108110
$exercise_id = intval($exercise_id);
109111
$dk_result = $em
110-
->getRepository('ChamiloCourseBundle:CQuiz')
112+
->getRepository(CQuiz::class)
111113
->findOneBy([
112114
'id' => $exercise_id,
113115
'cId' => $course_id,

public/main/inc/lib/webservices/Rest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ public function getCourseNotebooks()
590590
{
591591
$em = Database::getManager();
592592
/** @var CNotebookRepository $notebooksRepo */
593-
$notebooksRepo = $em->getRepository('ChamiloCourseBundle:CNotebook');
593+
$notebooksRepo = $em->getRepository(CNotebook::class);
594594
$notebooks = $notebooksRepo->findByUser($this->user, $this->course, $this->session);
595595

596596
return array_map(

public/main/lp/lp_final_item.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
/* For licensing terms, see /license.txt */
44

5+
use Chamilo\CoreBundle\Entity\Skill;
56
use Chamilo\CoreBundle\Framework\Container;
67

78
/**
@@ -233,7 +234,7 @@ function generateLPFinalItemTemplateBadgeLinks($userId, $courseId, $sessionId =
233234

234235
if ($userSkills) {
235236
foreach ($userSkills as $userSkill) {
236-
$skill = $em->find('ChamiloCoreBundle:Skill', $userSkill['skill_id']);
237+
$skill = $em->find(Skill::class, $userSkill['skill_id']);
237238
if (!$skill) {
238239
continue;
239240
}

public/main/lp/lp_report.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
if ('1' === $lp->getSubscribeUsers()) {
6464

6565
/** @var CLpRelUserRepository $cLpRelUserRepo */
66-
$cLpRelUserRepo = $em->getRepository('ChamiloCourseBundle:CLpRelUser');
66+
$cLpRelUserRepo = $em->getRepository(CLpRelUser::class);
6767
$subscribedUsersInLp = $cLpRelUserRepo->getUsersSubscribedToItem(
6868
$entity,
6969
$course,

public/main/portfolio/add_item.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Chamilo\CoreBundle\Event\PortfolioItemAddedEvent;
1010

1111
$categories = $em
12-
->getRepository('ChamiloCoreBundle:PortfolioCategory')
12+
->getRepository(PortfolioCategory::class)
1313
->findBy([
1414
'user' => $user,
1515
]);

public/main/portfolio/edit_item.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
/* For licensing terms, see /license.txt */
33

44
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
5+
use Chamilo\CoreBundle\Entity\PortfolioCategory;
56
use Chamilo\CoreBundle\Framework\Container;
67
use Chamilo\CoreBundle\Event\Events;
78
use Chamilo\CoreBundle\Event\PortfolioItemEditedEvent;
89

910
$categories = $em
10-
->getRepository('ChamiloCoreBundle:PortfolioCategory')
11+
->getRepository(PortfolioCategory::class)
1112
->findBy([
1213
'user' => $user,
1314
]);
@@ -37,7 +38,7 @@
3738
->setContent($values['content'])
3839
->setUpdateDate($currentTime)
3940
->setCategory(
40-
$em->find('ChamiloCoreBundle:PortfolioCategory', $values['category'])
41+
$em->find(PortfolioCategory::class, $values['category'])
4142
);
4243

4344
$em->persist($item);

public/main/portfolio/index.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
}
8383

8484
/** @var PortfolioCategory $category */
85-
$category = $em->find('ChamiloCoreBundle:PortfolioCategory', $id);
85+
$category = $em->find(PortfolioCategory::class, $id);
8686

8787
if (!$isValid($category)) {
8888
api_not_allowed(true);
@@ -99,7 +99,7 @@
9999
}
100100

101101
/** @var PortfolioCategory $category */
102-
$category = $em->find('ChamiloCoreBundle:PortfolioCategory', $id);
102+
$category = $em->find(PortfolioCategory::class, $id);
103103

104104
if (!$isValid($category)) {
105105
api_not_allowed(true);
@@ -124,7 +124,7 @@
124124
}
125125

126126
/** @var PortfolioCategory $category */
127-
$category = $em->find('ChamiloCoreBundle:PortfolioCategory', $id);
127+
$category = $em->find(PortfolioCategory::class, $id);
128128

129129
if (!$isValid($category)) {
130130
api_not_allowed(true);
@@ -150,7 +150,7 @@
150150
}
151151

152152
/** @var CPortfolio $item */
153-
$item = $em->find('ChamiloCoreBundle:Portfolio', $id);
153+
$item = $em->find(Portfolio::class, $id);
154154

155155
if (!$isValid($item)) {
156156
api_not_allowed(true);
@@ -167,7 +167,7 @@
167167
}
168168

169169
/** @var Portfolio $item */
170-
$item = $em->find('ChamiloCoreBundle:Portfolio', $id);
170+
$item = $em->find(Portfolio::class, $id);
171171

172172
if (!$isValid($item)) {
173173
api_not_allowed(true);
@@ -197,7 +197,7 @@
197197
}
198198

199199
/** @var Portfolio $item */
200-
$item = $em->find('ChamiloCoreBundle:Portfolio', $id);
200+
$item = $em->find(Portfolio::class, $id);
201201

202202
if (!$isValid($item)) {
203203
api_not_allowed(true);

public/main/portfolio/list.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
55
use Chamilo\CoreBundle\Component\Utils\ObjectIcon;
66
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
7+
use Chamilo\CoreBundle\Entity\Portfolio;
8+
use Chamilo\CoreBundle\Entity\PortfolioCategory;
79

810
if ($currentUserId == $user->getId()) {
911
if ($allowEdit) {
@@ -38,7 +40,7 @@
3840
}
3941

4042
$categories = $em
41-
->getRepository('ChamiloCoreBundle:PortfolioCategory')
43+
->getRepository(PortfolioCategory::class)
4244
->findBy($criteria);
4345

4446
if ($course) {
@@ -49,7 +51,7 @@
4951
$criteria['category'] = null;
5052

5153
$items = $em
52-
->getRepository('ChamiloCoreBundle:Portfolio')
54+
->getRepository(Portfolio::class)
5355
->findBy($criteria);
5456

5557
$template = new Template(null, false, false, false, false, false, false);

0 commit comments

Comments
 (0)