Slide 1

Slide 1 text

15 AVRIL 2015 @mickael_andrieu Use of Symfony in BackBee Content Manager

Slide 2

Slide 2 text

2 15 AVRIL 2015 What is BackBee ? Open source Content Manager, on top of Doctrine and Symfony components. An extensible but simple content manager 1 promise : FRONT = BACK

Slide 3

Slide 3 text

3 AVRIL 2015 The big picture : The « Standard Edition » BackBee Core BackBee Javascript Client Templating BackBee Infrastructure Applications Components Core API REST PHP Twig Smarty … Symfony Components Doctrine ORM Security / ACL Workflow Search Routing Events Profiler Logging Cache Config Bundle Contribution User Main Content … Bundle Auth Datastore FormBuilder … Translator TreeView LinkSelector i18n Request/Response REST

Slide 4

Slide 4 text

4 15 AVRIL 2015 Symfony & Doctrine contributions • Config • Console • Debug • DependencyInjection • EventDispatcher • ExpressionLanguage • FileSystem • HttpFoundation • HttpKernel • Routing • Security-Core • Security-ACL • Security-HTTP • Serializer • Translation • Validator • Yaml • Doctrine/Bridge • Doctrine/DBAL • Doctrine/ORM • Twig

Slide 5

Slide 5 text

5 15 AVRIL 2015 The contribution of Symfony in BackBee 5 components required by BackBee Core • HttpKernel (Application, Bundles) • HttpFoundation (Request/Response) • Event Dispatcher • Dependency Injection • Security

Slide 6

Slide 6 text

6 15 AVRIL 2015 Use of HttpKernel inside BackBee - 1/3 Backee is a Symfony Application $application = new \BackBee\Standard\Application(null, ‘default’); BackBee use environments and application contexts. Each BackBee Bundle can load his configuration

Slide 7

Slide 7 text

7 15 AVRIL 2015 Use of HttpKernel inside BackBee - 2/3 new \BackBee\Standard\Application(); new \BackBee\Standard\Application('preprod'); new \BackBee\Standard\Application(null, 'Api');

Slide 8

Slide 8 text

8 15 AVRIL 2015 Use of HttpKernel inside BackBee - 3/3 new \BackBee\Standard\Application('preprod'); Like in Symfony framework, the configuration are merged « on cascade » vendor/backbee/backbee/Config/config.yml repository/Config/config.yml repository/Config/preprod/config.yml

Slide 9

Slide 9 text

9 15 AVRIL 2015 Use of HttpFoundation inside BackBee - 1/2 A FrontController is in charge of return a Response from a Request. class FrontController implements Symfony\Component\HttpKernel\HttpKernelInterface { /* main request handler */ public function handle(Request $request = null,$type = self::MASTER_REQUEST, $catch = true) /* handles the request when none other action was found. */ public function defaultAction($uri = null, $sendResponse = true) /* specific request handlers */ public function rssAction($uri = null) public function rpcAction() }

Slide 10

Slide 10 text

10 15 AVRIL 2015 Use of HttpFoundation inside BackBee - 2/2 A RestController is in charge of return an API JsonResponse. abstract class AbstractRestController extends BackBee\Controller\Controller\Controller implements RestControllerInterface, FormatterInterface { // Default formatter for a object(s) public function formatCollection($collection, $format = 'json|jsonp') public function formatItem($item, $format = 'json') // Deserialize data into Doctrine entity. public function deserializeEntity(array $data, $entityOrClass) // Create a Symfony JsonResponse. protected function createJsonResponse($data = null, $status = 200, $headers = array()) }

Slide 11

Slide 11 text

11 15 AVRIL 2015 DependencyInjection inside BackBee - 1/2 Backee is very extensible and powerful thanks to « services » ~150 services, to manage Security, Doctrine, « Page Workflow » … Each Bundle can register services and commands

Slide 12

Slide 12 text

12 15 AVRIL 2015 DependencyInjection inside BackBee - 2/2 In application/CMS context, register a service is very easy. # /Users/Mickael/projects/MyApp/repository/Config/services.yml parameters: bbapp.cache.dir: 'C:\Users\Mickael\projects\MyApp\cache' secret_key: ThisSecretKeyMustBeChanged services: my_custom_service: class: MyApp\Bundle\AppBundle\Services\MyCustomService arguments: - @mailer - @logger - %secret_key% calls: - [setCache, [%bbapp.cache.dir%]]

Slide 13

Slide 13 text

13 15 AVRIL 2015 Use of Security inside BackBee - 1/2 BackBee provide a very precise management of rights; Users and Roles, and also Groups; Complete rights for a page, a block, a simple content;

Slide 14

Slide 14 text

14 15 AVRIL 2015 Use of Security inside BackBee - 2/2 # /Users/Mickael/projects/MyApp/repository/Config/groups.yml contributor: sites: resources: all actions: none layouts: resources: all actions: none workflow: resources: all actions: none pages: resources: all actions: [view, create, edit] contents: resources: all actions: all

Slide 15

Slide 15 text

15 15 AVRIL 2015 The BackBee Page Building - 1/3 We build Pages, based on Layouts and Contents; Each content in BackBee is at least an AbstractClassContent instance; The PageBuilder service is very extensible;

Slide 16

Slide 16 text

16 15 AVRIL 2015 The BackBee Page Building - 2/3

Slide 17

Slide 17 text

17 15 AVRIL 2015 The BackBee Page Building - 3/3

Slide 18

Slide 18 text

18 15 AVRIL 2015 The Content manager Based on PHP|Java ContentRepository specification; Definition of Contents in YAML, without any cache/database action; BackBee provides a list of basic Elements;

Slide 19

Slide 19 text

19 15 AVRIL 2015 The Content manager - Content Repository from phpcr.github.com All content is stored as a tree of Nodes; A Node has named Properties with values; Values can be scalar, file data or references to other nodes;

Slide 20

Slide 20 text

20 15 AVRIL 2015 The Content manager – Content definition No effect on the cache, without updating the database. # /Users/Mickael/projects/MyApp/repository/ClassContent/article.yml article: extends: BackBee\ClassContent\Breve traits: [BackBee\Traits\MyTrait] properties: name: Article description: | "An article contains a title, a main image and a customisable body" category: [article] elements: title: BackBee\ClassContent\Element\text image: BackBee\ClassContent\Media\image body: BackBee\ClassContent\article\paragraph

Slide 21

Slide 21 text

21 15 AVRIL 2015 The Content manager - Rendering

Slide 22

Slide 22 text

22 15 AVRIL 2015 BackBee is open source Github, of course ! A « QUALITY » approch You are welcome

Slide 23

Slide 23 text

23 15 AVRIL 2015 Thank you ! See you on Github  Powered by