diff --git a/src/CoreBundle/Component/Utils/ChamiloApi.php b/src/CoreBundle/Component/Utils/ChamiloApi.php
index 07dc90a5b1..c58d7a728b 100644
--- a/src/CoreBundle/Component/Utils/ChamiloApi.php
+++ b/src/CoreBundle/Component/Utils/ChamiloApi.php
@@ -442,6 +442,7 @@ class ChamiloApi
{
if (!empty($url)) {
header("Location: $url");
+
exit;
}
}
diff --git a/src/CoreBundle/Controller/SocialController.php b/src/CoreBundle/Controller/SocialController.php
index dc948196c7..e5c45857b5 100644
--- a/src/CoreBundle/Controller/SocialController.php
+++ b/src/CoreBundle/Controller/SocialController.php
@@ -272,10 +272,10 @@ class SocialController extends AbstractController
UserManager::update_extra_field_value($userId, $justificationFieldToUpdate, $explanation);
$request = $requestStack->getCurrentRequest();
- $baseUrl = $request->getSchemeAndHttpHost() . $request->getBasePath();
+ $baseUrl = $request->getSchemeAndHttpHost().$request->getBasePath();
$specificPath = '/main/admin/user_list_consent.php';
- $link = $baseUrl . $specificPath;
- $emailContent .= $translator->trans('Go here : '). '' . $link . '';
+ $link = $baseUrl.$specificPath;
+ $emailContent .= $translator->trans('Go here : ').''.$link.'';
$emailOfficer = $settingsManager->getSetting('profile.data_protection_officer_email');
if (!empty($emailOfficer)) {
@@ -666,7 +666,7 @@ class SocialController extends AbstractController
'status' => $isUserOnline ? 'online' : 'offline',
'url' => '/social?id='.$item['id'],
'relationType' => $relation['relationType'] ?? null,
- 'existingInvitations' => $existingInvitations
+ 'existingInvitations' => $existingInvitations,
];
}
} elseif ('group' === $type) {
diff --git a/src/CoreBundle/Entity/Language.php b/src/CoreBundle/Entity/Language.php
index a1b3f212f6..b1e75c7918 100644
--- a/src/CoreBundle/Entity/Language.php
+++ b/src/CoreBundle/Entity/Language.php
@@ -20,7 +20,7 @@ use Symfony\Component\Validator\Constraints as Assert;
/**
* Platform languages.
*/
-#[ApiResource(attributes: ["pagination_enabled" => false])]
+#[ApiResource(attributes: ['pagination_enabled' => false])]
#[ApiFilter(BooleanFilter::class, properties: ['available'])]
#[ApiFilter(OrderFilter::class, properties: ['english_name' => 'DESC'])]
#[ORM\Table(name: 'language', options: ['row_format' => 'DYNAMIC'])]
diff --git a/src/CoreBundle/EventListener/ExceptionListener.php b/src/CoreBundle/EventListener/ExceptionListener.php
index ab379fa79f..63b01a1a94 100644
--- a/src/CoreBundle/EventListener/ExceptionListener.php
+++ b/src/CoreBundle/EventListener/ExceptionListener.php
@@ -13,7 +13,6 @@ use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
-use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Twig\Environment;
class ExceptionListener
@@ -39,10 +38,10 @@ class ExceptionListener
if (null === $this->tokenStorage->getToken()) {
$currentUrl = $request->getUri();
$parsedUrl = parse_url($currentUrl);
- $baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'];
+ $baseUrl = $parsedUrl['scheme'].'://'.$parsedUrl['host'];
$path = rtrim($parsedUrl['path'], '/') ?: '';
$query = $parsedUrl['query'] ?? '';
- $redirectUrl = $baseUrl . $path . ($query ? '?' . $query : '');
+ $redirectUrl = $baseUrl.$path.($query ? '?'.$query : '');
$loginUrl = $this->router->generate('login', ['redirect' => $redirectUrl], UrlGeneratorInterface::ABSOLUTE_URL);
ChamiloApi::redirectTo($loginUrl);
diff --git a/src/CoreBundle/Exception/NotAllowedException.php b/src/CoreBundle/Exception/NotAllowedException.php
index 1dbdf3a6dc..fdac18d2f9 100644
--- a/src/CoreBundle/Exception/NotAllowedException.php
+++ b/src/CoreBundle/Exception/NotAllowedException.php
@@ -1,4 +1,5 @@
getManager();
- /* @var UserRepository $repo*/
+ /** @var UserRepository $repo */
$repo = $container->get(UserRepository::class);
$plainPassword = 'fallback_user';
@@ -46,7 +47,8 @@ class Version20240310160200 extends AbstractMigrationChamilo
->setPhone('0000000000')
->setLocale('en')
->setActive(User::SOFT_DELETED)
- ->setTimezone('UTC');
+ ->setTimezone('UTC')
+ ;
$em->flush();
error_log($fallbackUser->getFullname());
diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20240318105600.php b/src/CoreBundle/Migrations/Schema/V200/Version20240318105600.php
index 2bdda9fbf6..0e2c4e9ad7 100644
--- a/src/CoreBundle/Migrations/Schema/V200/Version20240318105600.php
+++ b/src/CoreBundle/Migrations/Schema/V200/Version20240318105600.php
@@ -1,4 +1,5 @@
addSql("CREATE TABLE color_theme (id INT AUTO_INCREMENT NOT NULL, variables LONGTEXT NOT NULL COMMENT '(DC2Type:json)', created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC");
diff --git a/src/CoreBundle/Repository/Node/UserRepository.php b/src/CoreBundle/Repository/Node/UserRepository.php
index 6ca82eee94..943d75c0b4 100644
--- a/src/CoreBundle/Repository/Node/UserRepository.php
+++ b/src/CoreBundle/Repository/Node/UserRepository.php
@@ -29,6 +29,7 @@ use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry;
+use Exception;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
@@ -166,8 +167,9 @@ class UserRepository extends ResourceRepository implements PasswordUpgraderInter
$em->flush();
$em->getConnection()->commit();
- } catch (\Exception $e) {
+ } catch (Exception $e) {
$em->getConnection()->rollBack();
+
throw $e;
}
}
@@ -289,17 +291,17 @@ class UserRepository extends ResourceRepository implements PasswordUpgraderInter
];
foreach ($relations as $relation) {
- $entityClass = 'Chamilo\\' . $relation['bundle'] . '\\Entity\\' . $relation['entity'];
+ $entityClass = 'Chamilo\\'.$relation['bundle'].'\\Entity\\'.$relation['entity'];
$repository = $em->getRepository($entityClass);
$records = $repository->findBy([$relation['field'] => $userToDelete]);
foreach ($records as $record) {
- $setter = 'set' . ucfirst($relation['field']);
- if ($relation['action'] === 'delete') {
+ $setter = 'set'.ucfirst($relation['field']);
+ if ('delete' === $relation['action']) {
$em->remove($record);
} elseif (method_exists($record, $setter)) {
- $valueToSet = $relation['type'] === 'object' ? $fallbackUser : $fallbackUser->getId();
- $record->$setter($valueToSet);
+ $valueToSet = 'object' === $relation['type'] ? $fallbackUser : $fallbackUser->getId();
+ $record->{$setter}($valueToSet);
if (method_exists($record, 'getResourceFile') && $record->getResourceFile()) {
$resourceFile = $record->getResourceFile();
if (!$em->contains($resourceFile)) {
@@ -319,7 +321,7 @@ class UserRepository extends ResourceRepository implements PasswordUpgraderInter
$fallbackUser = $this->findOneBy(['status' => User::ROLE_FALLBACK], ['id' => 'ASC']);
if (!$fallbackUser) {
- throw new \Exception("User not found.");
+ throw new Exception('User not found.');
}
return $fallbackUser;
diff --git a/src/CourseBundle/Entity/CAttendanceResultComment.php b/src/CourseBundle/Entity/CAttendanceResultComment.php
index 0d4410adc1..7173298140 100644
--- a/src/CourseBundle/Entity/CAttendanceResultComment.php
+++ b/src/CourseBundle/Entity/CAttendanceResultComment.php
@@ -9,9 +9,9 @@ use DateTime;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
-#[ORM\Table(name: "c_attendance_result_comment")]
-#[ORM\Index(columns: ["attendance_sheet_id"], name: "attendance_sheet_id")]
-#[ORM\Index(columns: ["user_id"], name: "user_id")]
+#[ORM\Table(name: 'c_attendance_result_comment')]
+#[ORM\Index(columns: ['attendance_sheet_id'], name: 'attendance_sheet_id')]
+#[ORM\Index(columns: ['user_id'], name: 'user_id')]
class CAttendanceResultComment
{
#[ORM\Column(name: 'iid', type: 'integer')]