Minor - fix entities + format code

pull/4014/head^2
Julio 5 years ago
parent 158d97d7e8
commit a244d71070
  1. 1
      public/main/inc/ajax/user_manager.ajax.php
  2. 4
      src/CoreBundle/Controller/CourseController.php
  3. 7
      src/CoreBundle/Entity/Session.php
  4. 18
      src/CoreBundle/Entity/SessionRelUser.php
  5. 4
      src/CoreBundle/Entity/User.php
  6. 2
      tests/CoreBundle/Controller/CourseControllerTest.php

@ -3,7 +3,6 @@
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Query\Expr\Join;
/**

@ -48,9 +48,10 @@ class CourseController extends ToolBaseController
{
#[Route('/{cid}/home.json', name: 'chamilo_core_course_home_json')]
#[Entity('course', expr: 'repository.find(cid)')]
public function indexJsonAction(Request $request, CToolRepository $toolRepository, CShortcutRepository $shortcutRepository, ToolChain $toolChain): Response
public function indexJson(Request $request, CToolRepository $toolRepository, CShortcutRepository $shortcutRepository, ToolChain $toolChain): Response
{
$course = $this->getCourse();
$sessionId = $this->getSessionId();
if (null === $course) {
throw $this->createAccessDeniedException();
@ -68,7 +69,6 @@ class CourseController extends ToolBaseController
$courseCode = $course->getCode();
$courseId = $course->getId();
$sessionId = $this->getSessionId();
if ($user && $user->hasRole('ROLE_INVITEE')) {
$isInASession = $sessionId > 0;

@ -599,12 +599,7 @@ class Session implements ResourceWithAccessUrlInterface
return $this;
}
/**
* Get visibility.
*
* @return int
*/
public function getVisibility()
public function getVisibility(): int
{
return $this->visibility;
}

@ -74,15 +74,6 @@ class SessionRelUser
{
use UserTrait;
/**
* @var string[]
*/
public array $relationTypeList = [
Session::STUDENT => 'student',
Session::DRH => 'drh',
Session::SESSION_COACH => 'session_coach',
];
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
@ -176,15 +167,6 @@ class SessionRelUser
return $this;
}
public function setRelationTypeByName(string $relationType): self
{
if (isset($this->relationTypeList[$relationType])) {
$this->setRelationType((int) $this->relationTypeList[$relationType]);
}
return $this;
}
public function getRelationType(): int
{
return $this->relationType;

@ -2265,7 +2265,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
/**
* Retrieves this user's related sessions.
*
* @param int $relationType \Chamilo\CoreBundle\Entity\SessionRelUser::relationTypeList key
* @param int $relationType
*
* @return Session[]
*/
@ -2294,7 +2294,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
/**
* Get this user's related accessible sessions of a type, student by default.
*
* @param int $relationType \Chamilo\CoreBundle\Entity\SessionRelUser::relationTypeList key
* @param int $relationType
*
* @return Session[]
*/

@ -18,7 +18,7 @@ class CourseControllerTest extends WebTestCase
{
use ChamiloTestTrait;
public function testIndexJsonAction(): void
public function testIndexJson(): void
{
$client = static::createClient();
$course = $this->createCourse('course 1');

Loading…
Cancel
Save