sulu / snippet-bundle
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
Requires
- php: >=5.4
- friendsofsymfony/rest-bundle: ~1.4
- sensio/framework-extra-bundle: 3.0.*
- sulu/admin-bundle: 0.9.*
- sulu/sulu: 0.9.*
- sulu/website-bundle: 0.9.*
Requires (Dev)
- matthiasnoback/symfony-dependency-injection-test: ~0.7.1
- phpunit/phpunit: 3.7.*
- sulu/test-bundle: 0.9.*
- symfony-cmf/testing: ~1.1
- symfony/monolog-bundle: 2.4.*
- symfony/symfony: 2.5.*
This package is not auto-updated.
Last update: 2016-03-10 09:53:29 UTC
README
Usage
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(
WHY?:
- 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.
TODO
- API Security
- Template loaders (in sulu/sulu!)