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

		try {
			if (!$request->request->get('filename')) {
				throw new CmsException(null, 'Folder title was not sent');
			}

			$dirName = $request->request->get('filename');
			$parentFolder = null;

			// Adding child folder if parent exists
			if ($request->request->get('parent')) {
				$parentFolder = $this->getFolder('parent');
			}

			$dir = $this->createFolder($dirName, $parentFolder);

			$manager->commit();
		} catch (\Exception $e) {
			$manager->rollback();
			$key = $e instanceof UploadFilterException ? $e->getMessageKey() : null;
			throw new CmsException($key, $e->getMessage(), $e);
		}

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

		try {
			if (!$request->request->get('filename')) {
				throw new CmsException(null, 'Folder title was not sent');
			}

			$dirName = $request->request->get('filename');
			$parentFolder = null;

			// Adding child folder if parent exists
			if ($request->request->get('parent')) {
				$parentFolder = $this->getFolder('parent');
			}

			$dir = $this->createFolder($dirName, $parentFolder);

			$manager->commit();
		} catch (\Exception $e) {
			$manager->rollback();
			$key = $e instanceof UploadFilterException ? $e->getMessageKey() : null;
			throw new CmsException($key, $e->getMessage(), $e);
		}

		$insertedId = $dir->getId();
		return new SupraJsonResponse($insertedId);
	}
public function insertAction ( Request $ request ) { $ manager = $ this -> container -> getDoctrine ( ) -> getManager ( ) ; $ repository = $ manager -> getRepository ( FileAbstraction :: CN ( ) ) ; /* @var $repository FileNestedSetRepository */ $ repository -> getNestedSetRepository ( ) -> lock ( ) ; $ manager -> beginTransaction ( ) ; try { if ( ! $ request -> request -> get ( 'filename' ) ) { throw new CmsException ( null , 'Folder title was not sent' ) ; } $ dirName = $ request -> request -> get ( 'filename' ) ; $ parentFolder = null ; // Adding child folder if parent exists if ( $ request -> request -> get ( 'parent' ) ) { $ parentFolder = $ this -> getFolder ( 'parent' ) ; } $ dir = $ this -> createFolder ( $ dirName , $ parentFolder ) ; $ manager -> commit ( ) ; } catch ( \ Exception $ e ) { $ manager -> rollback ( ) ; $ key = $ e instanceof UploadFilterException ? $ e -> getMessageKey ( ) : null ; throw new CmsException ( $ key , $ e -> getMessage ( ) , $ e ) ; } $ insertedId = $ dir -> getId ( ) ; return new SupraJsonResponse ( $ insertedId ) ; }
Creates new folders, despite it's name
Creates new folders despite it s name