Minor: Format code

pull/5337/head
Angel Fernando Quiroz Campos 1 year ago
parent c393da0140
commit 03d95b9ccd
  1. 10
      src/CoreBundle/Migrations/Schema/V200/Version20201215072917.php
  2. 4
      src/CoreBundle/Migrations/Schema/V200/Version20230216122900.php
  3. 3
      src/CoreBundle/Migrations/Schema/V200/Version20230904173400.php
  4. 6
      src/CourseBundle/Entity/CCalendarEvent.php
  5. 2
      tests/CoreBundle/Repository/PageRepositoryTest.php

@ -22,7 +22,7 @@ class Version20201215072917 extends AbstractMigrationChamilo
$selectedValue = $this->getConfigurationSelectedValue();
if ($settingExists == 0) {
if (0 == $settingExists) {
$this->addSql(
"INSERT INTO settings_current (access_url, variable, category, selected_value, title, access_url_changeable, access_url_locked) VALUES (1, 'allow_careers_in_global_agenda', 'agenda', '$selectedValue', 'Allow careers and promotions in global agenda', 1, 0)"
);
@ -50,17 +50,17 @@ class Version20201215072917 extends AbstractMigrationChamilo
{
global $_configuration;
$rootPath = $this->getContainer()->getParameter('kernel.project_dir');
$oldConfigPath = $rootPath . '/app/config/configuration.php';
if (!in_array($oldConfigPath, get_included_files(), true)) {
$oldConfigPath = $rootPath.'/app/config/configuration.php';
if (!\in_array($oldConfigPath, get_included_files(), true)) {
include_once $oldConfigPath;
}
$value = $_configuration['allow_careers_in_global_agenda'] ?? false;
if (is_bool($value)) {
if (\is_bool($value)) {
return $value ? 'true' : 'false';
}
return (string)$value;
return (string) $value;
}
public function down(Schema $schema): void

@ -676,14 +676,14 @@ class Version20230216122900 extends AbstractMigrationChamilo
}
$attachmentExists = $this->connection->fetchOne("SELECT COUNT(*) FROM extra_field WHERE variable = 'attachment' AND item_type = 13");
if ($attachmentExists == 0) {
if (0 == $attachmentExists) {
$this->addSql(
"INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (13, 18, 'attachment', 'Attachment', 1, 1, 1, NOW())"
);
}
$sendToCoachesExists = $this->connection->fetchOne("SELECT COUNT(*) FROM extra_field WHERE variable = 'send_to_coaches' AND item_type = 13");
if ($sendToCoachesExists == 0) {
if (0 == $sendToCoachesExists) {
$this->addSql(
"INSERT INTO extra_field (item_type, value_type, variable, display_text, visible_to_self, changeable, filter, created_at) VALUES (13, 13, 'send_to_coaches', 'Send to Coaches', 1, 1, 1, NOW())"
);

@ -225,12 +225,11 @@ class Version20230904173400 extends AbstractMigrationChamilo
/**
* @param array<int, CCalendarEvent> $oldNewEventIdMap
* @param EntityManagerInterface $em
* @return void
*/
private function updateAgendaReminders(array $oldNewEventIdMap, EntityManagerInterface $em): void
{
$reminders = $em->getRepository(AgendaReminder::class)->findBy(['type' => 'personal']);
/** @var AgendaReminder $reminder */
foreach ($reminders as $reminder) {
$oldEventId = $reminder->getEvent()->getIid();

@ -177,16 +177,10 @@ class CCalendarEvent extends AbstractResource implements ResourceInterface, Stri
#[ORM\OneToMany(mappedBy: 'event', targetEntity: AgendaReminder::class, cascade: ['persist'], orphanRemoval: true)]
private Collection $reminders;
/**
* @var Career|null
*/
#[ORM\ManyToOne(targetEntity: Career::class)]
#[ORM\JoinColumn(name: 'career_id', referencedColumnName: 'id', nullable: true)]
protected ?Career $career = null;
/**
* @var Promotion|null
*/
#[ORM\ManyToOne(targetEntity: Promotion::class)]
#[ORM\JoinColumn(name: 'promotion_id', referencedColumnName: 'id', nullable: true)]
protected ?Promotion $promotion = null;

@ -318,7 +318,7 @@ class PageRepositoryTest extends AbstractApiTest
$this->assertTrue($result);
$this->assertSame(2, $pageRepo->count([]));
$this->assertSame(
6 + count($createDefaultPages->getCategoriesForAdminBlocks()),
6 + \count($createDefaultPages->getCategoriesForAdminBlocks()),
$pageCategoryRepo->count([])
);

Loading…
Cancel
Save