Minor - format code

pull/4032/head
Julio 3 years ago
parent 888c296f5d
commit d844deeb0b
  1. 1
      src/CoreBundle/DataProvider/Extension/SessionRelUserExtension.php
  2. 44
      src/CoreBundle/Migrations/Schema/V200/Version20190210182615.php

@ -48,6 +48,7 @@ final class SessionRelUserExtension implements QueryCollectionExtensionInterface
$request = $this->requestStack->getCurrentRequest();
$alias = $qb->getRootAliases()[0];
$content = $request->getContent();
$now = new DateTime('now', new DateTimeZone('UTC'));
$date = $now->format('Y-m-d H:i:s');

@ -116,22 +116,26 @@ class Version20190210182615 extends AbstractMigrationChamilo
$sessionId = (int) $item['id'];
if (!empty($coachId)) {
$result = $connection->executeQuery("SELECT * FROM session_rel_user WHERE user_id = $coachId AND session_id = $sessionId AND relation_type = 3 ");
$items = $result->fetchAllAssociative();
if (empty($items)) {
$this->addSql(
"INSERT INTO session_rel_user (relation_type, duration, registered_at, user_id, session_id) VALUES (3, 0, NOW(), $coachId, $sessionId)"
);
$sql = "SELECT * FROM session_rel_user
WHERE user_id = $coachId AND session_id = $sessionId AND relation_type = 3 ";
$result = $connection->executeQuery($sql);
$exists = $result->fetchAllAssociative();
if (empty($exists)) {
$sql = "INSERT INTO session_rel_user (relation_type, duration, registered_at, user_id, session_id)
VALUES (3, 0, NOW(), $coachId, $sessionId)";
$this->addSql($sql);
}
}
if (!empty($adminId)) {
$result = $connection->executeQuery("SELECT * FROM session_rel_user WHERE user_id = $adminId AND session_id = $sessionId AND relation_type = 4 ");
$items = $result->fetchAllAssociative();
if (empty($items)) {
$this->addSql(
"INSERT INTO session_rel_user (relation_type, duration, registered_at, user_id, session_id) VALUES (4, 0, NOW(), $adminId, $sessionId)"
);
$sql = "SELECT * FROM session_rel_user
WHERE user_id = $adminId AND session_id = $sessionId AND relation_type = 4 ";
$result = $connection->executeQuery($sql);
$exists = $result->fetchAllAssociative();
if (empty($exists)) {
$sql = "INSERT INTO session_rel_user (relation_type, duration, registered_at, user_id, session_id)
VALUES (4, 0, NOW(), $adminId, $sessionId)";
$this->addSql($sql);
}
}
}
@ -147,14 +151,14 @@ class Version20190210182615 extends AbstractMigrationChamilo
$sessionId = (int) $item['session_id'];
$status = (int) $item['status'];
if (!empty($userId)) {
$result = $connection->executeQuery(
"SELECT * FROM session_rel_user WHERE user_id = $userId AND session_id = $sessionId AND relation_type = $status "
);
$items = $result->fetchAllAssociative();
if (empty($items)) {
$this->addSql(
"INSERT INTO session_rel_user (relation_type, duration, registered_at, user_id, session_id) VALUES ($status, 0, NOW(), $userId, $sessionId)"
);
$sql = "SELECT * FROM session_rel_user
WHERE user_id = $userId AND session_id = $sessionId AND relation_type = $status";
$result = $connection->executeQuery($sql);
$exists = $result->fetchAllAssociative();
if (empty($exists)) {
$sql = "INSERT INTO session_rel_user (relation_type, duration, registered_at, user_id, session_id)
VALUES ($status, 0, NOW(), $userId, $sessionId)";
$this->addSql($sql);
}
}
}

Loading…
Cancel
Save