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

		$file = $this->getEntity();

		$parentId = $request->get('parent_id');

		$target = null;
		if ( ! empty($parentId)) {
			$target = $this->container->getDoctrine()->getManager()->getRepository(FileAbstraction::CN())
				->findOneById($parentId);
		}

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

		// try to move
		try {
			$this->getFileStorage()->move($file, $target);
		} catch (\Supra\Package\Cms\FileStorage\Exception\RuntimeException $e) {
			throw new CmsException(null, $e->getMessage());
		}

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

		$file = $this->getEntity();

		$parentId = $request->get('parent_id');

		$target = null;
		if ( ! empty($parentId)) {
			$target = $this->container->getDoctrine()->getManager()->getRepository(FileAbstraction::CN())
				->findOneById($parentId);
		}

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

		// try to move
		try {
			$this->getFileStorage()->move($file, $target);
		} catch (\Supra\Package\Cms\FileStorage\Exception\RuntimeException $e) {
			throw new CmsException(null, $e->getMessage());
		}

		return new SupraJsonResponse();
	}
public function moveAction ( Request $ request ) { $ repository = $ this -> container -> getDoctrine ( ) -> getManager ( ) -> getRepository ( FileAbstraction :: CN ( ) ) ; /* @var $repository FileNestedSetRepository */ $ repository -> getNestedSetRepository ( ) -> lock ( ) ; $ file = $ this -> getEntity ( ) ; $ parentId = $ request -> get ( 'parent_id' ) ; $ target = null ; if ( ! empty ( $ parentId ) ) { $ target = $ this -> container -> getDoctrine ( ) -> getManager ( ) -> getRepository ( FileAbstraction :: CN ( ) ) -> findOneById ( $ parentId ) ; } if ( $ file === null ) { throw new CmsException ( null , 'File doesn\'t exist anymore' ) ; } // try to move try { $ this -> getFileStorage ( ) -> move ( $ file , $ target ) ; } catch ( \ Supra \ Package \ Cms \ FileStorage \ Exception \ RuntimeException $ e ) { throw new CmsException ( null , $ e -> getMessage ( ) ) ; } return new SupraJsonResponse ( ) ; }
Moving, currently only for folders
Moving currently only for folders