Return of the ResourceToRootInterface

pull/3924/head
Julio Montoya 4 years ago
parent 4980bd1530
commit 1a93a1758c
  1. 15
      src/CoreBundle/Entity/Listener/ResourceListener.php
  2. 2
      src/CoreBundle/Entity/ResourceToRootInterface.php

@ -14,6 +14,7 @@ use Chamilo\CoreBundle\Entity\ResourceFile;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\ResourceRight;
use Chamilo\CoreBundle\Entity\ResourceToRootInterface;
use Chamilo\CoreBundle\Entity\ResourceType;
use Chamilo\CoreBundle\Entity\ResourceWithAccessUrlInterface;
use Chamilo\CoreBundle\Entity\Session;
@ -76,15 +77,11 @@ class ResourceListener
}
}
if ($resource->hasResourceNode()) {
// This will attach the resource to the main resource node root (For example a Course).
/*if ($resource instanceof ResourceToRootInterface) {
$url = $this->getAccessUrl($em);
$resource->getResourceNode()->setParent($url->getResourceNode());
}
error_log('resource has already a resource node. Do nothing');
// Do not override resource node, it's already added.
return true;*/
//if ($resource->hasResourceNode()) {
// This will attach the resource to the main resource node root (For example a Course).
if ($resource instanceof ResourceToRootInterface) {
$accessUrl = $this->getAccessUrl($em, $request);
$resource->setParent($accessUrl);
}
// Check if creator was set with $resource->setCreator()

@ -8,8 +8,6 @@ namespace Chamilo\CoreBundle\Entity;
/**
* This will attach the resource to the main resource node root (For example a Course).
*
* @deprecated use ResourceWithAccessUrlInterface
*/
interface ResourceToRootInterface
{

Loading…
Cancel
Save