Ejemplo n.º 1
0
 /**
  * Delete a workspace.
  *
  * @param \Claroline\CoreBundle\Entity\Workspace\Workspace $workspace
  */
 public function deleteWorkspace(Workspace $workspace)
 {
     $root = $this->resourceManager->getWorkspaceRoot($workspace);
     if ($root) {
         $children = $root->getChildren();
         if ($children) {
             foreach ($children as $node) {
                 $this->resourceManager->delete($node);
             }
         }
     }
     $this->dispatcher->dispatch('claroline_workspaces_delete', 'GenericDatas', array(array($workspace)));
     $this->om->remove($workspace);
     $this->om->flush();
 }
Ejemplo n.º 2
0
 /**
  * Delete a workspace.
  *
  * @param \Claroline\CoreBundle\Entity\Workspace\Workspace $workspace
  */
 public function deleteWorkspace(Workspace $workspace)
 {
     $this->om->startFlushSuite();
     $root = $this->resourceManager->getWorkspaceRoot($workspace);
     if ($root) {
         $this->log('Removing root directory ' . $root->getName() . '[id:' . $root->getId() . ']');
         $children = $root->getChildren();
         $this->log('Looping through ' . count($children) . ' children...');
         if ($children) {
             foreach ($children as $node) {
                 $this->resourceManager->delete($node);
             }
         }
     }
     $this->dispatcher->dispatch('claroline_workspaces_delete', 'GenericDatas', [[$workspace]]);
     $this->om->remove($workspace);
     $this->om->endFlushSuite();
 }