This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. The author suggests using the sulu/sulu package instead.
The bundle provides to create/manage/use snippets for content management in Sulu
0.1.0 2014-10-29 17:43 UTC
Snippets can be managed using existing APIs.
Why not use a SnippetManager to act as a proxy?
- More code to manager = more errors
- Limits reuse of existing code (e.g. AJAX endpoints)
Get snippet types:
$structureManager = $this->getContainer('sulu.structure_manager'); $snippetTypes = $structureManager->getTemplates(Structure::TYPE_SNIPPET);
Get a snippet:
$contentMapper = $this->getContainer('sulu.content.mapper'); $contentMapper->load($snippetUuid, $webspace, $languageCode);
Save a snippet:
$req = ContentMapperRequest::create() ->setType('snippet') ->setTemplateKey('hotel') ->setLocale('de') ->setUserId(1) ->setData(array( 'name' => 'L\'Hôtel New Hampshire', )); $hotel2 = $this->contentMapper->saveRequest($req); $contentMapper->saveRequest(
- Dependency management: A manager which does all of the above has overlapping dependencies and lack of purpose
- Refactoring: Using proxies protects against refactoring breakages in one respect but makes things worse ultimately -- you end up having lots of different interfaces for the same things.
- API Security
- Template loaders (in sulu/sulu!)