Submit Search
Upload
Application Layer in PHP
•
2 likes
•
3,375 views
Per Bernhardt
Follow
Vortrag über eine beispielhafte Implementierung eines Application Layers in PHP
Read less
Read more
Technology
Report
Share
Report
Share
1 of 32
Download now
Download to read offline
Recommended
Microservice Teststrategie mit Symfony2
Microservice Teststrategie mit Symfony2
Per Bernhardt
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012
D
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Per Bernhardt
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
Jace Ju
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
Michael Peacock
Implementing Comet using PHP
Implementing Comet using PHP
King Foo
Intro to Silex
Intro to Silex
Joey Rivera
はじめてのSymfony2
はじめてのSymfony2
Tomohiro MITSUMUNE
Recommended
Microservice Teststrategie mit Symfony2
Microservice Teststrategie mit Symfony2
Per Bernhardt
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012
D
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Per Bernhardt
What happens in laravel 4 bootstraping
What happens in laravel 4 bootstraping
Jace Ju
Dance for the puppet master: G6 Tech Talk
Dance for the puppet master: G6 Tech Talk
Michael Peacock
Implementing Comet using PHP
Implementing Comet using PHP
King Foo
Intro to Silex
Intro to Silex
Joey Rivera
はじめてのSymfony2
はじめてのSymfony2
Tomohiro MITSUMUNE
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
clkao
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
Workhorse Computing
Node.js Express
Node.js Express
Eyal Vardi
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
Building Web Apps with Express
Building Web Apps with Express
Aaron Stannard
Tatsumaki
Tatsumaki
Tatsuhiko Miyagawa
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Zend by Rogue Wave Software
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
Wallace Reis
Composer
Composer
Tom Corrigan
Nodejs first class
Nodejs first class
Fin Chen
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
V2 and beyond
V2 and beyond
jimi-c
Plack - LPW 2009
Plack - LPW 2009
Tatsuhiko Miyagawa
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in Ruby
LaunchAny
Building Cloud Castles
Building Cloud Castles
Ben Scofield
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w Laravelu
Laravel Poland MeetUp
Phinx talk
Phinx talk
Michael Peacock
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
Shinya Ohyanagi
Puppet and the HashiStack
Puppet and the HashiStack
Bram Vogelaar
CQRS
CQRS
Piotr Pelczar
Domain Driven Design
Domain Driven Design
Ürgo Ringo
More Related Content
What's hot
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
clkao
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Ryan Weaver
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
Workhorse Computing
Node.js Express
Node.js Express
Eyal Vardi
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
jimi-c
Building Web Apps with Express
Building Web Apps with Express
Aaron Stannard
Tatsumaki
Tatsumaki
Tatsuhiko Miyagawa
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Zend by Rogue Wave Software
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
Wallace Reis
Composer
Composer
Tom Corrigan
Nodejs first class
Nodejs first class
Fin Chen
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Tatsuhiko Miyagawa
V2 and beyond
V2 and beyond
jimi-c
Plack - LPW 2009
Plack - LPW 2009
Tatsuhiko Miyagawa
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in Ruby
LaunchAny
Building Cloud Castles
Building Cloud Castles
Ben Scofield
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w Laravelu
Laravel Poland MeetUp
Phinx talk
Phinx talk
Michael Peacock
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
Shinya Ohyanagi
Puppet and the HashiStack
Puppet and the HashiStack
Bram Vogelaar
What's hot
(20)
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Selenium sandwich-3: Being where you aren't.
Selenium sandwich-3: Being where you aren't.
Node.js Express
Node.js Express
AnsibleFest 2014 - Role Tips and Tricks
AnsibleFest 2014 - Role Tips and Tricks
Building Web Apps with Express
Building Web Apps with Express
Tatsumaki
Tatsumaki
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
Speed up web APIs with Expressive and Swoole (PHP Day 2018)
A reviravolta do desenvolvimento web
A reviravolta do desenvolvimento web
Composer
Composer
Nodejs first class
Nodejs first class
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
V2 and beyond
V2 and beyond
Plack - LPW 2009
Plack - LPW 2009
Using Sinatra to Build REST APIs in Ruby
Using Sinatra to Build REST APIs in Ruby
Building Cloud Castles
Building Cloud Castles
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w Laravelu
Phinx talk
Phinx talk
Zend Framework Study@Tokyo #2
Zend Framework Study@Tokyo #2
Puppet and the HashiStack
Puppet and the HashiStack
Viewers also liked
CQRS
CQRS
Piotr Pelczar
Domain Driven Design
Domain Driven Design
Ürgo Ringo
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
Alan Christensen
Application Architecture by Lars-Erik Kindblad, Capgemini
Application Architecture by Lars-Erik Kindblad, Capgemini
Lars-Erik Kindblad
The Fluent Interface Pattern
The Fluent Interface Pattern
Lars-Erik Kindblad
Application Architecture April 2014
Application Architecture April 2014
Lars-Erik Kindblad
Middleware PHP - A simple micro-framework
Middleware PHP - A simple micro-framework
Corley S.r.l.
Rich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 Application
Kirill Chebunin
Hexagonal architecture - message-oriented software design (PHP Benelux 2016)
Hexagonal architecture - message-oriented software design (PHP Benelux 2016)
Matthias Noback
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
Ross Tuck
CQRS на практике. В поиске точки масштабирования и новых метафор
CQRS на практике. В поиске точки масштабирования и новых метафор
Alexander Byndyu
Lecture application layer
Lecture application layer
Hasam Panezai
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
Steve Rhoades
Clean architecture with ddd layering in php
Clean architecture with ddd layering in php
Leonardo Proietti
Network Layer,Computer Networks
Network Layer,Computer Networks
guesta81d4b
Viewers also liked
(15)
CQRS
CQRS
Domain Driven Design
Domain Driven Design
Domain Driven Design Demonstrated
Domain Driven Design Demonstrated
Application Architecture by Lars-Erik Kindblad, Capgemini
Application Architecture by Lars-Erik Kindblad, Capgemini
The Fluent Interface Pattern
The Fluent Interface Pattern
Application Architecture April 2014
Application Architecture April 2014
Middleware PHP - A simple micro-framework
Middleware PHP - A simple micro-framework
Rich Model And Layered Architecture in SF2 Application
Rich Model And Layered Architecture in SF2 Application
Hexagonal architecture - message-oriented software design (PHP Benelux 2016)
Hexagonal architecture - message-oriented software design (PHP Benelux 2016)
Models and Service Layers, Hemoglobin and Hobgoblins
Models and Service Layers, Hemoglobin and Hobgoblins
CQRS на практике. В поиске точки масштабирования и новых метафор
CQRS на практике. В поиске точки масштабирования и новых метафор
Lecture application layer
Lecture application layer
Implementing DDD Concepts in PHP
Implementing DDD Concepts in PHP
Clean architecture with ddd layering in php
Clean architecture with ddd layering in php
Network Layer,Computer Networks
Network Layer,Computer Networks
Similar to Application Layer in PHP
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
Hisateru Tanaka
What's New In Laravel 5
What's New In Laravel 5
Darren Craig
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support
Ben Scofield
symfony on action - WebTech 207
symfony on action - WebTech 207
patter
Crafting Quality PHP Applications (Bucharest Tech Week 2017)
Crafting Quality PHP Applications (Bucharest Tech Week 2017)
James Titcumb
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Sam Brannen
Building Lithium Apps
Building Lithium Apps
Nate Abele
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
Hugo Hamon
Event Sourcing with php
Event Sourcing with php
Sébastien Houzé
Crafting Quality PHP Applications (PHP Benelux 2018)
Crafting Quality PHP Applications (PHP Benelux 2018)
James Titcumb
Speed up your developments with Symfony2
Speed up your developments with Symfony2
Hugo Hamon
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
Michelangelo van Dam
Crafting Quality PHP Applications (ConFoo YVR 2017)
Crafting Quality PHP Applications (ConFoo YVR 2017)
James Titcumb
Primefaces Confess 2012
Primefaces Confess 2012
cagataycivici
Crafting Quality PHP Applications (PHPkonf 2018)
Crafting Quality PHP Applications (PHPkonf 2018)
James Titcumb
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
James Titcumb
实战Ecos
实战Ecos
wanglei999
Primefaces Nextgen Lju
Primefaces Nextgen Lju
Skills Matter
Primefaces Nextgen Lju
Primefaces Nextgen Lju
Skills Matter
Similar to Application Layer in PHP
(20)
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
What's New In Laravel 5
What's New In Laravel 5
And the Greatest of These Is ... Rack Support
And the Greatest of These Is ... Rack Support
symfony on action - WebTech 207
symfony on action - WebTech 207
Crafting Quality PHP Applications (Bucharest Tech Week 2017)
Crafting Quality PHP Applications (Bucharest Tech Week 2017)
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
Building Lithium Apps
Building Lithium Apps
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
Event Sourcing with php
Event Sourcing with php
Crafting Quality PHP Applications (PHP Benelux 2018)
Crafting Quality PHP Applications (PHP Benelux 2018)
Speed up your developments with Symfony2
Speed up your developments with Symfony2
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
Crafting Quality PHP Applications (ConFoo YVR 2017)
Crafting Quality PHP Applications (ConFoo YVR 2017)
Primefaces Confess 2012
Primefaces Confess 2012
Crafting Quality PHP Applications (PHPkonf 2018)
Crafting Quality PHP Applications (PHPkonf 2018)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
实战Ecos
实战Ecos
Primefaces Nextgen Lju
Primefaces Nextgen Lju
Primefaces Nextgen Lju
Primefaces Nextgen Lju
More from Per Bernhardt
Die Rolle des CTO
Die Rolle des CTO
Per Bernhardt
Event Carried State Transfer @ LeanIX
Event Carried State Transfer @ LeanIX
Per Bernhardt
Communication in a Microservice Architecture (Ljubljana Backend Meetup 2021)
Communication in a Microservice Architecture (Ljubljana Backend Meetup 2021)
Per Bernhardt
Microservice Test Strategy (@Bonn Code Meetup)
Microservice Test Strategy (@Bonn Code Meetup)
Per Bernhardt
Communication in a Microservice Architecture
Communication in a Microservice Architecture
Per Bernhardt
Magazin-Relaunch bei Chefkoch
Magazin-Relaunch bei Chefkoch
Per Bernhardt
Contract Tests mit Pact
Contract Tests mit Pact
Per Bernhardt
Chefkoch goes Drupal8
Chefkoch goes Drupal8
Per Bernhardt
Umzug eines Hochlast-Dienstes
Umzug eines Hochlast-Dienstes
Per Bernhardt
kubernetes @ chefkoch.de - Kubernetes Meetup Cologne
kubernetes @ chefkoch.de - Kubernetes Meetup Cologne
Per Bernhardt
Continiuous Integration and Delivery with Bamboo
Continiuous Integration and Delivery with Bamboo
Per Bernhardt
Anwendungsintegration mit Edge Side Includes
Anwendungsintegration mit Edge Side Includes
Per Bernhardt
More from Per Bernhardt
(12)
Die Rolle des CTO
Die Rolle des CTO
Event Carried State Transfer @ LeanIX
Event Carried State Transfer @ LeanIX
Communication in a Microservice Architecture (Ljubljana Backend Meetup 2021)
Communication in a Microservice Architecture (Ljubljana Backend Meetup 2021)
Microservice Test Strategy (@Bonn Code Meetup)
Microservice Test Strategy (@Bonn Code Meetup)
Communication in a Microservice Architecture
Communication in a Microservice Architecture
Magazin-Relaunch bei Chefkoch
Magazin-Relaunch bei Chefkoch
Contract Tests mit Pact
Contract Tests mit Pact
Chefkoch goes Drupal8
Chefkoch goes Drupal8
Umzug eines Hochlast-Dienstes
Umzug eines Hochlast-Dienstes
kubernetes @ chefkoch.de - Kubernetes Meetup Cologne
kubernetes @ chefkoch.de - Kubernetes Meetup Cologne
Continiuous Integration and Delivery with Bamboo
Continiuous Integration and Delivery with Bamboo
Anwendungsintegration mit Edge Side Includes
Anwendungsintegration mit Edge Side Includes
Recently uploaded
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Precisely
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Florian Wilhelm
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Rizwan Syed
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Pixlogix Infotech
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Mattias Andersson
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
NavinnSomaal
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
Stephanie Beckett
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
Hervé Boutemy
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
Alan Dix
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
Lonnie McRorey
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
ScyllaDB
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Lorenzo Miniero
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Addepto
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
gvaughan
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
Manik S Magar
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
BookNet Canada
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
Slibray Presentation
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Alex Barbosa Coqueiro
Recently uploaded
(20)
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Application Layer in PHP
1.
Application Layer ein Vortrag
von Per Bernhardt
2.
Agenda • Disclaimer /
Credits • Ein kleines bisschen Theorie • Ein echtes Beispiel: Chefkoch API
3.
4.
Credit goes to… •
http://martinfowler.com/ • http://domainlanguage.com/ • http://alistair.cockburn.us/ • http://www.whitewashing.de/ • und viele andere..
5.
Ein bisschen Theorie…
6.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer
7.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer - Controller - Template / HTML - Session / HTTP
8.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer - Controller - Template / HTML - Session / HTTP - Fasade - Transaktionen - Sicherheit / Zugriffsschutz - Integration / Orchestrierung
9.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer - Controller - Template / HTML - Session / HTTP - Fasade - Transaktionen - Sicherheit / Zugriffsschutz - Integration / Orchestrierung - Daten - Geschäftslogik
10.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer - Controller - Template / HTML - Session / HTTP - Fasade - Transaktionen - Sicherheit / Zugriffsschutz - Integration / Orchestrierung - Daten - Geschäftslogik - Datenbank - Mailserver - Logger - …
11.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer - Controller - Template / HTML - Session / HTTP - Fasade - Transaktionen - Sicherheit / Zugriffsschutz - Integration / Orchestrierung - Daten - Geschäftslogik - Datenbank - Mailserver - Logger - …
12.
Application Layer Presentation Layer Infrastructure
Layer Domain Layer - Controller - Template / HTML - Session / HTTP - Fasade - Transaktionen - Sicherheit / Zugriffsschutz - Integration / Orchestrierung - Daten - Geschäftslogik - Datenbank - Mailserver - Logger - …
13.
Chefkoch API
14.
15.
POST /cookbooks/{id}/categories
16.
<?php ! namespace ChefkochBundleApiBundleController; ! use SymfonyBundleFrameworkBundleControllerController; use
ChefkochDomainModelCookbookCookbookId use SensioBundleFrameworkExtraBundleConfigurationParamConverter; use ChefkochBundleApiBundleAnnotationApiSerialize; use ChefkochApplicationCookbookRequest; use ChefkochApplicationCookbookCommand; use PixelhouseApplicationEventDispatchingService; use PixelhouseApplicationResponse; ! class CookbookController extends Controller { ! ... ! /** * @ParamConverter("category", options={"deserialize"=true}) * @ApiSerialize * @return Response */ public function saveCategoryAction(CookbookId $cookbookId, RequestCategoryRequest $category) { return $this->getCookbookService()->execute( new CommandSaveCategoryCommand($cookbookId, $category) ); } ! ... ! /** * @return DispatchingService */ private function getCookbookService() { return $this->get('chefkoch_api.application.cookbook_service'); } }
17.
<?php ! namespace ChefkochApplicationCookbookCommand; ! use ChefkochApplicationCookbookRequestCategoryRequest; use
ChefkochApplicationCookbookSecurityCookbookWriteAccessRequired; use ChefkochDomainModelCookbookCookbookId; use PixelhouseApplicationCommand; ! class SaveCategoryCommand implements Command, CookbookWriteAccessRequired { ! /** @var CookbookId */ private $cookbookId; ! /** @var CategoryRequest */ private $categoryRequest; ! public function __construct(CookbookId $cookbookId, CategoryRequest $categoryRequest) { $this->cookbookId = $cookbookId; $this->categoryRequest = $categoryRequest; } ! public function getCookbookId() { return $this->cookbookId; } ! public function getCategoryRequest() { return $this->categoryRequest; } }
18.
<?php ! namespace PixelhouseApplicationEvent; ! use PixelhouseApplicationCommand; use
PixelhouseApplicationUseCase; use PixelhouseEventDispatcherEventDispatcher; ! class DispatchingService { ! /** @var EventDispatcher */ private $eventDispatcher; ! /** @var UseCase[] */ private $useCases = array(); ! public function __construct(EventDispatcher $eventDispatcher) { $this->eventDispatcher = $eventDispatcher; } ! public function registerCommand($commandClass, UseCase $useCase) { $this->useCases[$commandClass] = $useCase; } ! public function execute(Command $command) { ... } }
19.
<?php ! namespace PixelhouseApplicationEvent; ! class Events { const
PRE_COMMAND = 'application.pre_command'; const POST_COMMAND = 'application.post_command'; const EXCEPTION = 'application.exception'; }
20.
<?php ! namespace PixelhouseApplicationEvent; ! use PixelhouseApplicationCommand; ! class
DispatchingService { ! ... ! public function execute(Command $command) { try { $this->eventDispatcher->dispatch( Events::PRE_COMMAND, new CommandEvent($command) ); $response = $this->useCases[get_class($command)]->run($command); $this->eventDispatcher->dispatch( Events::POST_COMMAND, new PostCommandEvent($command, $response) ); ! return $response; } catch (Exception $exception) { $event = new CommandExceptionEvent($command, $exception); $this->eventDispatcher->dispatch( Events::EXCEPTION, $event ); if ($response = $event->getResponse()) { return $response; } else { throw $exception; } } } }
21.
<?php ! namespace ChefkochInfrastructureApplication; ! use PixelhouseApplicationEvent; use
PixelhouseEventDispatcherSubscriber; use DoctrineORMEntityManager; ! class DoctrineTransactionListener implements Subscriber { ! /** @var EntityManager */ private $entityManager; ! public function __construct(EntityManager $entityManager) { $this->entityManager = $entityManager; } ! public function preCommand(EventCommandEvent $event) { $this->entityManager->getConnection()->beginTransaction(); } ! public function postCommand(EventPostCommandEvent $event) { $this->entityManager->flush(); $this->entityManager->getConnection()->commit(); } ! public function onException(EventCommandExceptionEvent $event) { $this->entityManager->close(); if ($this->entityManager->getConnection()->isTransactionActive()) { $this->entityManager->getConnection()->rollBack(); } } }
22.
<?php ! namespace PixelhouseApplicationSecurity; ! use PixelhouseApplicationEvent; use
PixelhouseEventDispatcherSubscriber; ! class SecurityListener implements Subscriber { ! /** @var Context */ private $context; ! /** @var Policy[] */ private $policies = array(); ! public function __construct(Context $context) { $this->context = $context; } ! public function addPolicy(Policy $policy) { $this->policies[] = $policy; } ! /** * throws Exception */ public function preCommand(EventCommandEvent $event) { foreach ($this->policies as $policy) { $policy->check($this->securityContext, $event->getCommand()); } } }
23.
<?php ! namespace ChefkochApplicationCookbookSecurity; ! use ChefkochDomainModelCookbookCookbookRepository; use
ChefkochUserDomainModelUserRepository; use PixelhouseApplicationCommand; use PixelhouseApplicationSecurityAccessDeniedException; use PixelhouseApplicationSecurityContext; use PixelhouseApplicationSecurityPolicy; ! class CookbookAccessPolicy implements Policy { ! /** @var CookbookRepository */ private $cookbookRepository; ! /** @var UserRepository */ private $userRepository; ! public function __construct(CookbookRepository $cbRepo, UserRepository $uRepo) { $this->cookbookRepository = $cbRepo; $this->userRepository = $uRepo; } ! public function check(Context $context, Command $command) { if ($command instanceof CookbookWriteAccessRequired) { $cookbook = $this->cookbookRepository->findOneById($command->getCookbookId()); $user = $this->userRepository->findOneById($context->getUserId()); ! // Zugriff prüfen ... ! throw new AccessDeniedException(); } } }
24.
<?xml version="1.0" ?> <container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services
..."> <services> ... ! <service id="chefkoch_api.application.use_case.cookbook_save_category" class="ChefkochApplicationCookbookUseCaseSaveCategory"> <argument type="service" id="chefkoch_api.infrastructure.cookbook_category_repository" /> <argument type="service" id="chefkoch_api.infrastructure.user_repository" /> <argument type="service" id="chefkoch_api.application.security_context" /> <tag name="chefkoch_api.application.use_case" commandClass="ChefkochApplicationCookbookCommandSaveCategoryCommand" applicationService="chefkoch_api.application.cookbook_service" /> </service> ! ... </services> </container>
25.
<?php ! namespace ChefkochApplicationCookbookUseCase; ! use ChefkochApplicationCookbookCommandSaveCategoryCommand; use
PixelhouseApplicationSecurityContext; use PixelhouseApplicationUseCase; use ChefkochDomainModelCookbookCategoryRepository; use ChefkochUserDomainModelUserRepository; ! class SaveCategory implements UseCase { ! /** @var CategoryRepository */ private $categoryRepository; ! /** @var UserRepository */ private $userRepository; ! /** @var Context */ private $context; ! public function __construct(CategoryRepository $cRepo, UserRepository $uRepo, Context $context) { $this->categoryRepository = $cRepo; $this->userRepository = $uRepo; $this->context = $context; } ! public function run(SaveCategoryCommand $command) { ... } }
26.
<?php ! namespace ChefkochApplicationCookbookUseCase; ! use PixelhouseApplicationUseCase; use
ChefkochApplicationCookbookCommandSaveCategoryCommand; use ChefkochDomainModelCookbookCategory; use ChefkochApplicationCookbookNotificationCategorySavedSuccess; use ChefkochApplicationCookbookResponseCategoryResponse; use PixelhouseApplicationResponse; ! class SaveCategory implements UseCase { ... ! public function run(SaveCategoryCommand $command) { $user = $this->userRepository->findOneById($this->context->getUserId()); ! $category = new Category( $command->getCookbookId(), $user->getId(), $command->getCategoryRequest()->getName(), $command->getCategoryRequest()->getDescriptionText() ); ! $this->categoryRepository->add($category); ! $categoryResponse = new CategoryResponse($category, $user); ! $response = new Response(); $response->getNotification()->addMessage(new CategorySavedSuccess($categoryResponse)); ! return $response; } }
27.
HTTP/1.1 201 Created
28.
29.
30.
31.
Per Bernhardt info@perprogramming.de perprogramming.de slideshare.net/perprogramming
32.
Bilder • Warning: https://www.flickr.com/photos/gerardstolk/ 6538330609 •
Show Time: https://www.flickr.com/photos/ florida_photo_guy/5212663826 • Question Marks: https://www.flickr.com/photos/ loneblackrider/315302588 • Thank You: https://www.flickr.com/photos/wwworks/ 4759535950
Download now