/** * @param string $title * * @return AssetCollection */ protected function getOrCreateCollection($title) { if (isset($this->collectionFirstLevelCache[$title])) { return $this->collectionFirstLevelCache[$title]; } $collection = $this->collectionRepository->findOneByTitle($title); if ($collection === null) { $collection = new AssetCollection($title); $this->collectionRepository->add($collection); } $this->collectionFirstLevelCache[$title] = $collection; return $collection; }
/** * @param string $title * @return void * @Flow\Validate(argumentName="title", type="NotEmpty") * @Flow\Validate(argumentName="title", type="Label") */ public function createAssetCollectionAction($title) { $this->assetCollectionRepository->add(new AssetCollection($title)); $this->addFlashMessage('collectionHasBeenCreated', '', Message::SEVERITY_OK, [htmlspecialchars($title)]); $this->redirect('index'); }
/** * @param string $title * @return void * @Flow\Validate(argumentName="title", type="NotEmpty") * @Flow\Validate(argumentName="title", type="Label") */ public function createAssetCollectionAction($title) { $this->assetCollectionRepository->add(new AssetCollection($title)); $this->addFlashMessage(sprintf('Collection "%s" has been created.', $title)); $this->redirect('index'); }