Internal: Refactor function names.

pull/3466/head
Julio Montoya 4 years ago
parent 436e5b549a
commit ed57e1f53f
  1. 2
      src/CoreBundle/Controller/EditorController.php
  2. 4
      src/CoreBundle/Controller/ResourceUploadController.php
  3. 6
      src/CoreBundle/EventSubscriber/ResolveResourceFileContentUrlSubscriber.php
  4. 2
      src/CoreBundle/Repository/ResourceFactory.php
  5. 2
      src/CoreBundle/Traits/ResourceControllerTrait.php

@ -78,7 +78,7 @@ class EditorController extends BaseController
$session = $this->getCourseSession();
$parent = $course->getResourceNode();
$repository = $resourceFactory->createRepository($tool, $type);
$repository = $resourceFactory->getRepositoryService($tool, $type);
$class = $repository->getRepository()->getClassName();
if (!empty($parentId)) {

@ -53,8 +53,10 @@ class ResourceUploadController extends BlueimpController
// Create repository from tool and type.
$factory = $container->get('Chamilo\CoreBundle\Repository\ResourceFactory');
$repoService = $factory->getRepositoryService($tool, $type);
/** @var ResourceRepository $repo */
$repo = $factory->createRepository($tool, $type);
$repo = $container->get($repoService);
/** @var ResourceNode $parent */
$parent = $repo->getResourceNodeRepository()->find($id);

@ -55,6 +55,10 @@ class ResolveResourceFileContentUrlSubscriber implements EventSubscriberInterfac
}
$getFile = $request->get('getFile');
/*$courseId = (int) $request->get('cid');
$sessionId = (int) $request->get('sid');*/
foreach ($mediaObjects as $mediaObject) {
if (!$mediaObject instanceof AbstractResource) {
continue;
@ -64,6 +68,8 @@ class ResolveResourceFileContentUrlSubscriber implements EventSubscriberInterfac
$params = [
'id' => $resourceNode->getId(),
// 'cid' => $courseId,
//'sid' => $sessionId,
'tool' => $resourceNode->getResourceType()->getTool()->getName(),
'type' => $resourceNode->getResourceType()->getName(),
];

@ -20,7 +20,7 @@ class ResourceFactory
$this->toolChain = $toolChain;
}
public function getRepository(string $tool, string $type)
public function getRepositoryService(string $tool, string $type): string
{
$tool = $this->toolChain->getToolFromName($tool);

@ -31,7 +31,7 @@ trait ResourceControllerTrait
public function getRepository($tool, $type): ResourceRepository
{
$name = $this->getResourceRepositoryFactory()->getRepository($tool, $type);
$name = $this->getResourceRepositoryFactory()->getRepositoryService($tool, $type);
return $this->container->get($name);
}

Loading…
Cancel
Save