public function renameFolder(Folder $folder, $newTitle)
	{
		$entityManager = $this->getDoctrineEntityManager();
		$entityManager->beginTransaction();
		$oldFolder = clone($folder);
		$entityManager->detach($oldFolder);

		try {
			$folder->setFileName($newTitle);

			// validating folder before renaming
			foreach ($this->folderUploadFilters as $filter) {
				$filter->validateFolder($folder);
			}

			$entityManager->flush();

			// rename folder in both file storages
			$this->renameFolderInFileSystem($oldFolder, $folder);
		} catch (\Exception $e) {
			$entityManager->detach($folder);
			$entityManager->rollback();

			throw $e;
		}

		$entityManager->commit();
	}
public function renameFolder(Folder $folder, $newTitle)
	{
		$entityManager = $this->getDoctrineEntityManager();
		$entityManager->beginTransaction();
		$oldFolder = clone($folder);
		$entityManager->detach($oldFolder);

		try {
			$folder->setFileName($newTitle);

			// validating folder before renaming
			foreach ($this->folderUploadFilters as $filter) {
				$filter->validateFolder($folder);
			}

			$entityManager->flush();

			// rename folder in both file storages
			$this->renameFolderInFileSystem($oldFolder, $folder);
		} catch (\Exception $e) {
			$entityManager->detach($folder);
			$entityManager->rollback();

			throw $e;
		}

		$entityManager->commit();
	}
public function renameFolder ( Folder $ folder , $ newTitle ) { $ entityManager = $ this -> getDoctrineEntityManager ( ) ; $ entityManager -> beginTransaction ( ) ; $ oldFolder = clone ( $ folder ) ; $ entityManager -> detach ( $ oldFolder ) ; try { $ folder -> setFileName ( $ newTitle ) ; // validating folder before renaming foreach ( $ this -> folderUploadFilters as $ filter ) { $ filter -> validateFolder ( $ folder ) ; } $ entityManager -> flush ( ) ; // rename folder in both file storages $ this -> renameFolderInFileSystem ( $ oldFolder , $ folder ) ; } catch ( \ Exception $ e ) { $ entityManager -> detach ( $ folder ) ; $ entityManager -> rollback ( ) ; throw $ e ; } $ entityManager -> commit ( ) ; }
Rename folder in all file storages.
Doesn't involve moving the folder in another folder.
@param Folder $folder
@param string $newTitle new folder name
Rename folder in all file storages . Doesn t involve moving the folder in another folder .