public function deleteAction()
	{
		$repository = $this->container->getDoctrine()->getManager()->getRepository(FileAbstraction::CN());
		/* @var $repository FileNestedSetRepository */
		$repository->getNestedSetRepository()->lock();

		$file = $this->getEntity();

		$this->checkActionPermission($file, FileAbstraction::PERMISSION_DELETE_NAME);

		if (is_null($file)) {
			throw new CmsException(null, 'File doesn\'t exist anymore');
		}

		// try to delete
		try {
			if ($file->hasChildren()) {
				$confirmation = $this->getConfirmation('Are You sure?');

				if ($confirmation instanceof Response) {
					return $confirmation;
				}

				$this->removeFilesRecursively($file);
			} else {
				$this->removeSingleFile($file);
			}
		} catch (NotEmptyException $e) {
			// Should not happen
			throw new CmsException(null, "Cannot delete not empty folders");
		}

		return new SupraJsonResponse(null);
	}
public function deleteAction()
	{
		$repository = $this->container->getDoctrine()->getManager()->getRepository(FileAbstraction::CN());
		/* @var $repository FileNestedSetRepository */
		$repository->getNestedSetRepository()->lock();

		$file = $this->getEntity();

		$this->checkActionPermission($file, FileAbstraction::PERMISSION_DELETE_NAME);

		if (is_null($file)) {
			throw new CmsException(null, 'File doesn\'t exist anymore');
		}

		// try to delete
		try {
			if ($file->hasChildren()) {
				$confirmation = $this->getConfirmation('Are You sure?');

				if ($confirmation instanceof Response) {
					return $confirmation;
				}

				$this->removeFilesRecursively($file);
			} else {
				$this->removeSingleFile($file);
			}
		} catch (NotEmptyException $e) {
			// Should not happen
			throw new CmsException(null, "Cannot delete not empty folders");
		}

		return new SupraJsonResponse(null);
	}
public function deleteAction ( ) { $ repository = $ this -> container -> getDoctrine ( ) -> getManager ( ) -> getRepository ( FileAbstraction :: CN ( ) ) ; /* @var $repository FileNestedSetRepository */ $ repository -> getNestedSetRepository ( ) -> lock ( ) ; $ file = $ this -> getEntity ( ) ; $ this -> checkActionPermission ( $ file , FileAbstraction :: PERMISSION_DELETE_NAME ) ; if ( is_null ( $ file ) ) { throw new CmsException ( null , 'File doesn\'t exist anymore' ) ; } // try to delete try { if ( $ file -> hasChildren ( ) ) { $ confirmation = $ this -> getConfirmation ( 'Are You sure?' ) ; if ( $ confirmation instanceof Response ) { return $ confirmation ; } $ this -> removeFilesRecursively ( $ file ) ; } else { $ this -> removeSingleFile ( $ file ) ; } } catch ( NotEmptyException $ e ) { // Should not happen throw new CmsException ( null , "Cannot delete not empty folders" ) ; } return new SupraJsonResponse ( null ) ; }
Deletes file or folder
Deletes file or folder