extending a symfony application by cms features
TRANSCRIPT
![Page 1: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/1.jpg)
EXTENDING A SYMFONY APPLICATION BY CMS FEATURESEXTENDING A SYMFONY APPLICATION BY CMS FEATURESMAXIMILIAN BERGHOFF - 01.12.2016 - MEETUP MAYFLOWER BERLINMAXIMILIAN BERGHOFF - 01.12.2016 - MEETUP MAYFLOWER BERLIN
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
1 von 38 02.12.2016 06:45
![Page 2: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/2.jpg)
Maximilian [email protected]/electricmaxxxMay�ower GmbH - WürzburgMaximilian.Berghoff@may�ower.de
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
2 von 38 02.12.2016 06:45
![Page 3: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/3.jpg)
ONCE UPON A TIME ...ONCE UPON A TIME ...SYMFONY APPLICATIONSYMFONY APPLICATION
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
3 von 38 02.12.2016 06:45
![Page 4: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/4.jpg)
THE LITTLE CONTENTTHE LITTLE CONTENTstatic content pages (legals, company info, ...)content blocks (news, events, abstracts, ...)content by business domain (product info, highlights, ...)
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
4 von 38 02.12.2016 06:45
![Page 5: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/5.jpg)
CONTENT EDITORCONTENT EDITOREDITABLE ALL CONTENTEDITABLE ALL CONTENT
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
5 von 38 02.12.2016 06:45
![Page 6: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/6.jpg)
SEOEditable RoutingEditable Menu Structure
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
6 von 38 02.12.2016 06:45
![Page 7: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/7.jpg)
CMSCMS
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
7 von 38 02.12.2016 06:45
![Page 8: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/8.jpg)
Typo 3WordpressJoomlaDrupal...
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
8 von 38 02.12.2016 06:45
![Page 9: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/9.jpg)
DIYDIY
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
9 von 38 02.12.2016 06:45
![Page 10: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/10.jpg)
Content editingPersisting dif�cult structured contentdynamic routingi18nSEOPublish work�owNice User Interface
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
10 von 38 02.12.2016 06:45
![Page 11: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/11.jpg)
ONCE UPON A TIMEONCE UPON A TIMESYMFONY APPLICATIONSYMFONY APPLICATION
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
11 von 38 02.12.2016 06:45
![Page 12: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/12.jpg)
FRAMEWORKFRAMEWORKCONTENT MANAGEMENT FRAMEWORKCONTENT MANAGEMENT FRAMEWORK
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
12 von 38 02.12.2016 06:45
![Page 13: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/13.jpg)
WHAT IS CONTENT?WHAT IS CONTENT?text blocksHTML snippetsMedia �les (images, videos, ...)List/Containers of snippets, text or references
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
13 von 38 02.12.2016 06:45
![Page 14: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/14.jpg)
BEHIND THE SCENES:BEHIND THE SCENES:PHPCRPHPCR
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
14 von 38 02.12.2016 06:45
![Page 15: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/15.jpg)
CMF = COMPONENTSCMF = COMPONENTS
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
15 von 38 02.12.2016 06:45
![Page 16: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/16.jpg)
PHPCR - INTERFACEPHPCR - INTERFACEJACKALOPE DoctrineDBALJackrabbit
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
16 von 38 02.12.2016 06:45
![Page 17: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/17.jpg)
DOCTRINEDOCTRINEphpcr-odmDoctrinePHPCRBundle
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
17 von 38 02.12.2016 06:45
![Page 18: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/18.jpg)
SYMFONY CMFSYMFONY CMFComponents (routing, resources)Bundles (core, routing, content, menu, ...)
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
18 von 38 02.12.2016 06:45
![Page 19: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/19.jpg)
ACTIONACTION
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
19 von 38 02.12.2016 06:45
![Page 20: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/20.jpg)
DYNAMIC ROUTINGDYNAMIC ROUTING
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
20 von 38 02.12.2016 06:45
![Page 21: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/21.jpg)
use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
NodeHelper::createPath( $manager->getPhpcrSession(), '/cms/routes');
$routeBase = $manager->find(null, '/cms/routes');
$route = new Route();$route->setPosition($routeBase, 'route_only');$route->addDefaults([ '_controller' => 'froscon_app.ctrl.default:routeOnlyAction']);
$manager->persist($route);$manager->flush();
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
21 von 38 02.12.2016 06:45
![Page 22: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/22.jpg)
ADVANCEDADVANCED
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
22 von 38 02.12.2016 06:45
![Page 23: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/23.jpg)
$contentParent = $manager->find(null, '/cms/content');$routeParent = $manager->find(null, '/cms/routes');$menuParent = $manager->find(null, '/cms/menu');
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
23 von 38 02.12.2016 06:45
![Page 24: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/24.jpg)
$enRoute = new Route(); $enRoute->setPosition($routeParent, 'en'); $manager->persist($enRoute); $deRoute = new Route(); $deRoute->setPosition($routeParent, 'de'); $manager->persist($deRoute);
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
24 von 38 02.12.2016 06:45
![Page 25: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/25.jpg)
$enServiceRoute = new Route();$enServiceRoute->setPosition($enRoute, 'services');$manager->persist($enServiceRoute);$deServiceRoute = new Route();$deServiceRoute->setPosition($deRoute, 'dienstleistungen');$manager->persist($deServiceRoute);
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
25 von 38 02.12.2016 06:45
![Page 26: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/26.jpg)
use Symfony\Cmf\Bundle\ContentBundle\Doctrine\Phpcr\StaticContent;
$content = new StaticContent();$content->setParentDocument($contentParent);$content->setName('symfony-service');$manager->persist($content);
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
26 von 38 02.12.2016 06:45
![Page 27: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/27.jpg)
$content->setTitle('Symfony Service');$content->setBody('A page about Symfony service');$manager->bindTranslation($content, 'en');$contentRoute = new Route();$contentRoute->setPosition($enServiceRoute, 'symfony-service');$contentRoute->setContent($content);$manager->persist($contentRoute);
$content->setTitle('Symfony Dienstleistungen');$content->setBody('Eine Seite über Symfony Dienstleistungen');$manager->bindTranslation($content, 'de');$contentRoute = new Route();$contentRoute->setPosition($deServiceRoute, 'symfony-dienstleistungen');$contentRoute->setContent($content);$manager->persist($contentRoute);
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
27 von 38 02.12.2016 06:45
![Page 28: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/28.jpg)
/de/dienstleistungen/symfony-dienstleistungen/en/services/symfony-service
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
28 von 38 02.12.2016 06:45
![Page 29: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/29.jpg)
cmf_routing: dynamic: templates_by_class: \..\StaticContent: ApplicationBundle:Page:index.html.twig chain: routers_by_id: cmf_routing.dynamic_router: 200 router.default: 100
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
29 von 38 02.12.2016 06:45
![Page 30: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/30.jpg)
$menu = new Menu();$menu->setPosition($menuParent, 'footer');$manager->persist($menu);
$menuNode = new MenuNode();$menuNode->setParentDocument($menu);$menuNode->setContent($content);$menuNode->setName('symfony-service');$manager->persist($menuNode);
$menuNode->setLabel('Symfony Services');$manager->bindTranslation($menuNode, 'en');$menuNode->setLabel('Symfony Dienstleistungen');$manager->bindTranslation($menuNode, 'de');
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
30 von 38 02.12.2016 06:45
![Page 31: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/31.jpg)
SEOSEO
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
31 von 38 02.12.2016 06:45
![Page 32: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/32.jpg)
$content = new DemoSeoContent();$content->setParentDocument($contentParent);$content->setName('seo-service');$content->setTitle('SEO Service');$content->setBody('A page about SEO service');
$metaData = new SeoMetadata();$metaData->setMetaDescription('Description in Metadata');$content->setSeoMetadata($metaData);
$manager->persist($content);
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
32 von 38 02.12.2016 06:45
![Page 33: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/33.jpg)
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
class DemoSeoContent extends StaticContent implements SeoAwareInterface, TitleReadInterface{ /** * @PHPCRODM\Child */ protected $seoMetadata;
public function getSeoTitle() { return 'By extractor - ' . $this->getTitle(); }}
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
33 von 38 02.12.2016 06:45
![Page 34: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/34.jpg)
CONCLUSIONCONCLUSION
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
34 von 38 02.12.2016 06:45
![Page 35: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/35.jpg)
QUESTIONS?QUESTIONS?Ask Now!Twitter: @ElectricMaxxxMail: Maximilian.Berghoff@may�ower.de
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
35 von 38 02.12.2016 06:45
![Page 36: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/36.jpg)
LINKSLINKSWebsiteDocumentationMailinglistIRCSandboxCode Examples mentioned here
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
36 von 38 02.12.2016 06:45
![Page 37: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/37.jpg)
THANK YOU!THANK YOU!+
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
37 von 38 02.12.2016 06:45
![Page 38: Extending a symfony application by cms features](https://reader031.vdocuments.us/reader031/viewer/2022021813/58a96ea11a28abfd648b6917/html5/thumbnails/38.jpg)
< <
CMF - Mayflower Berlin Meetup http://localhost:8000/CMF/?print-pdf#/
38 von 38 02.12.2016 06:45