As presented at ZendCon 2014, AmsterdamPHP, PHPBenelux 2014, Sweetlake PHP and PHP Northwest 2013, an overview of some different patterns for integrating and managing logic throughout your application.
JQuery provides methods to manipulate DOM in efficient way. You do not need to write big code to modify the value of any element's attribute or to extract HTML code from a paragraph or division.
JQuery provides methods such as .attr(), .html(), and .val() which act as getters, retrieving information from DOM elements for later use.
This document discusses logical database design and the relational model. It defines key concepts like relations, rows, columns, primary keys, and foreign keys. It explains how entity-relationship diagrams are transformed into relational schemas through mapping of entities, attributes, relationships and other constructs. The document also covers topics like integrity constraints, normalization, and the goals of normalization in eliminating anomalies and producing well-structured relations.
Creación indices y constraints en bases de datos de sql serverDIANAEVELINSOLISGONZ
El documento describe los pasos para configurar las tablas y datos de una base de datos bibliotecaria. Inicialmente borra los datos existentes y luego agrega índices, restricciones y llaves primarias y foráneas a las tablas Usuarios, Autores y Libros. Finalmente, introduce datos manualmente a las tablas y genera un diagrama de la base de datos.
This keyword is a reference variable that refer the current object in java.
This keyword can be used for call current class constructor.
http://www.tutorial4us.com/java/java-this-keyword
El documento explica los pasos para crear un nuevo inicio de sesión y usuario en SQL Server y otorgarles permisos y derechos específicos sobre tablas y esquemas. En primer lugar, se crea un nuevo inicio de sesión llamado "Lara" y luego un usuario con el mismo nombre ligado a ese inicio de sesión. A continuación, se le otorgan al usuario Lara diferentes derechos de lectura, escritura y actualización sobre varias tablas y esquemas a través de código SQL. Finalmente, se prueba la conexión al serv
Traditionally, we create structural models for our applications, and store the state of these models in our databases.
But there are alternatives: Event Sourcing is the idea that you can store all the domain events that affect an entity, and replay these events to restore the object's state. This may sound counterintuitive, because of all the years we've spent building relational, denormalized database schemas. But it is in fact quite simple, elegant, and powerful.
In the past year, I've had the pleasure of building and shipping two event sourced systems. In this session, I will show practical code, to give you a feel of how you can build event sourced models using PHP.
Mathias Verraes is a recovering music composer turned programmer, consultant, blogger, speaker, and podcaster. He advises companies on how to build enterprise web applications for complex business domains . For some weird reason, he enjoys working on large legacy projects: the kind where there’s half a million lines of spaghetti code, and nobody knows how to get the codebase under control. He’s the founder of the Domain-Driven Design Belgium community. When he’s not working, he’s at home in Kortrijk, Belgium, helping his two sons build crazy Lego train tracks.
http://verraes.net
This document discusses different types of inheritance in object-oriented programming including single, multiple, multilevel, hierarchical, and hybrid inheritance. It provides syntax examples and code samples to illustrate each type of inheritance. Key points made include that single inheritance allows a derived class to inherit from one base class, multiple inheritance allows a class to inherit from more than one parent class, and hybrid inheritance combines two or more inheritance types.
My talk about Functional Programming with Groovy at Greach
Greach http://greach.es/
the Groovy spanish conf
Date:
04-11-2011
Deep dive into Xtext scoping local and global scopes explainedHolger Schill
This document discusses scoping in Xtext, including local versus global scoping, how scopes are created, and some best practices when working with scopes. Key points include:
- Scopes describe the reachable elements in a given context and map names to EObjects.
- Local scopes are created by language developers while the global scope (index) tracks elements across resources.
- Language builders override getScope() to define scoping logic. Avoid cyclic references when collecting elements.
- The global index tracks exported elements from resource descriptions to enable cross-file references.
- Best practices include using user data instead of resolving proxies, validating instead of tight scoping, and avoiding direct resource loading.
Operators are elements in C# that are applied to operands in expressions or statements. Unary operators take one operand, like increment (++), while binary operators take two operands, such as arithmetic operators (+, -, *, /). The conditional operator (?:) is the sole ternary operator, taking three operands. Some common operators are assignment (=), arithmetic, comparison, conditional (&&, ||), ternary (?:), and null coalescing (??). Operator precedence and associativity determine the order of evaluation in expressions with multiple operators. Parentheses can be used to override precedence.
Spring Data provides abstractions and implementations for accessing relational and NoSQL data stores. It includes modules for specific databases like Spring Data JPA. Repositories provide basic CRUD operations and can define custom query methods. Entities represent database tables with annotations for properties, relationships, and inheritance. The EntityManager manages persistence contexts and entity instances.
The static keyword in Java is used for memory management and can be applied to variables, methods, blocks, and nested classes. Static variables and methods belong to the class rather than objects. A static variable is loaded when the class is loaded and there is only one copy per class, while instance variables are loaded each time an object is created. The main method must be static since it is called before any objects are created to start the program execution. Static blocks are used to initialize static variables and are executed when the class is loaded.
Doctrine MongoDB ODM is an object document mapper for PHP that provides tools for managing object persistence with MongoDB. It allows developers to work with MongoDB documents as objects and provides a query API and change tracking functionality to make common operations like inserting, updating, and deleting documents straightforward. Doctrine abstracts away the low-level MongoDB driver to allow developers to work with documents and references between documents using familiar object-oriented patterns.
El documento proporciona información sobre el rendimiento de crucero, ajuste de la mezcla de combustible, temperaturas del motor, pérdida de sustentación, recuperación de tirabuzones, descensos, aterrizajes, operación en tiempo frío y reducción de ruido para un Cessna T-210L. Explica cómo optimizar la velocidad de crucero, el rango y la economía de combustible mediante el ajuste de la altitud, las RPM y la mezcla de combustible.
This document discusses domain modeling in a functional world based on the speaker's real life experiences. The speaker covers topics like immutability and algebraic data types, updating domain models functionally using lenses, type classes for domain modeling, and managing states functionally. The speaker advocates for isolating pure domain logic from side effects to make the logic easier to test, reason about, and parallelize. Functional composition is emphasized as a way to build complex abstractions from simpler ones.
A struct in C# is a value type that can contain fields, methods, properties and other structs. It is useful for small data structures like Point, Rectangle, Color. Unlike classes, structs are allocated on the stack instead of the heap. Structs can implement interfaces but cannot inherit from other classes or be inherited by other classes. To declare a struct, use the struct keyword followed by the struct name and members. Struct objects are created using the new operator and members accessed using dot notation.
Functional Programming is preferred since it uses pure functions and values and keeps side effects at bay. However, while building real-life applications, side effects are often needed in the scenario when, say, one needs to query a database or read from or write to the stream.
If you’re facing this challenge in your projects too, then IO Monads can come to your rescue. Explore how using IO Monads, Scala developers can smoothly encapsulate side effects and write graceful programs while maintaining purity in Functional programming.
1. How to deal with side-effects in Scala in a purely functional way?
2. Important features like
a) Synchronous and asynchronous computations
b) Error handling
c) Concurrency
d) Parallelism
e) Cancellation
The document contains the source code for 7-10 experiments in an ASP.NET Software Technology Lab Manual. The experiments cover topics like using dropdown lists, listboxes, textbox events, radio buttons, validation in textboxes, and data list controls in ASP.NET. It also includes a longer experiment on performing CRUD (create, read, update, delete) operations on a student database using ADO.NET Entity Framework. The experiments provide the ASP.NET code and screenshots of the output for each program.
Este documento presenta una lista de abreviaturas y códigos utilizados en los Procedimientos para los Servicios de Navegación Aérea de la Organización de Aviación Civil Internacional. La lista contiene abreviaturas en inglés y su correspondiente traducción al español para términos relacionados con meteorología, navegación aérea, comunicaciones y gestión del tránsito aéreo. La séptima edición de este documento, publicada en 2007, reemplaza todas las ediciones anteriores.
MRI Conditional Pacemaker
This document discusses MRI conditional pacemakers and the process for patients with these devices to undergo MRI scans safely. It provides information on:
1) The components and basic principles of how MRI machines work to produce images.
2) How pacemaker systems were designed with solutions like minimizing ferromagnetic materials and optimizing circuitry to reduce interactions with the MRI's magnetic and radiofrequency fields.
3) Clinical study results demonstrating the safety and effectiveness of MRI conditional pacemakers, with no differences found in capture thresholds or sensed amplitudes before and after MRI scans.
4) Recommended patient care pathways for MRI scans including pre-screening, pre-scan preparation through programming the pacemaker,
The document discusses tween animation in Android. It explains that tween animation takes parameters like start/end values, duration, and rotation to animate an object. The Animation class is used to load animations from XML files using AnimationUtils. Example code shows how to create zoom in/out, rotate, and fade animations by defining XML files and starting the animations on a menu click.
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
SQL functions allow users to perform calculations on data, modify individual data items, manipulate output for groups of rows, and format dates and numbers for display. Functions are divided into several groups including single row functions, aggregate functions, analytic functions, object reference functions, and user-defined functions. Single row functions can execute the same operation for every row retrieved by a query.
This document is an introduction to Getting Started with Grails, Second Edition. It will use a sample application called RaceTrack to demonstrate how to build a Grails application from scratch. Readers will learn about core Grails concepts like domain classes, controllers, views, validation, relationships and more by building out the RaceTrack application. The goal is to provide a running club a way to track races and runner registrations digitally by leveraging the Grails framework.
Enterprise PHP: mappers, models and servicesAaron Saray
One of the greatest failures PHP has is not that it is a bad language, but that it isn't marketed as a good language. Since it's so easy to do it bad, a lot of people do just that. However, there is hope. Businesses ARE using PHP for Enterprise! You just need to apply a solid foundation to the language to get to that Enterprise level.
With our mind on the Enterprise sphere, it's time to take PHP programming to a more advanced level. To get the most out of this talk, you should already be familiar with object oriented programming concepts in PHP. To begin with, I'll talk about the need for a service layer, data mappers, and business object models. Then I'll demonstrate examples of how to do it right. As an added bonus, I'm not going to just tell you why it's best practice and a "good idea" - I'm going to SHOW you. This might be the first time in your life that you realize that changes in architecture, supporting infrastructure, and business requirements don't have to be as painful as you once thought!
The slides of my talk at PUGRoma.
Here, a complete sample code
https://github.com/leopro/trip-planner
Presentation is also here: http://t.co/5EK56yYBmQ
Enterprise PHP Architecture through Design Patterns and Modularization (Midwe...Aaron Saray
Object Oriented Programming in enterprise level PHP is incredibly important. In this presentation, concepts like MVC architecture, data mappers, services, and domain and data models will be discussed. Simple demonstrations will be used to show patterns and best practices. In addition, using tools like Doctrine or integration with Salesforce or the AS/400 will also be discussed. There will be an emphasis on the practical application of these techniques as well - this isn't just a theoretical talk! This presentation is great for those just beginning to create enterprise applications as well as those who have had years of experience.
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
This document summarizes a presentation on building a rich domain model with Symfony2 and Doctrine2. It discusses modeling the domain by focusing on the problem space rather than the solution space. It emphasizes making the domain model ubiquitous by using a common language throughout the code and contexts. The presentation also covers using entities as both domain objects and persistence model objects, validating inputs and protecting invariants, and taking an iterative test-driven approach to developing the domain model.
My talk about Functional Programming with Groovy at Greach
Greach http://greach.es/
the Groovy spanish conf
Date:
04-11-2011
Deep dive into Xtext scoping local and global scopes explainedHolger Schill
This document discusses scoping in Xtext, including local versus global scoping, how scopes are created, and some best practices when working with scopes. Key points include:
- Scopes describe the reachable elements in a given context and map names to EObjects.
- Local scopes are created by language developers while the global scope (index) tracks elements across resources.
- Language builders override getScope() to define scoping logic. Avoid cyclic references when collecting elements.
- The global index tracks exported elements from resource descriptions to enable cross-file references.
- Best practices include using user data instead of resolving proxies, validating instead of tight scoping, and avoiding direct resource loading.
Operators are elements in C# that are applied to operands in expressions or statements. Unary operators take one operand, like increment (++), while binary operators take two operands, such as arithmetic operators (+, -, *, /). The conditional operator (?:) is the sole ternary operator, taking three operands. Some common operators are assignment (=), arithmetic, comparison, conditional (&&, ||), ternary (?:), and null coalescing (??). Operator precedence and associativity determine the order of evaluation in expressions with multiple operators. Parentheses can be used to override precedence.
Spring Data provides abstractions and implementations for accessing relational and NoSQL data stores. It includes modules for specific databases like Spring Data JPA. Repositories provide basic CRUD operations and can define custom query methods. Entities represent database tables with annotations for properties, relationships, and inheritance. The EntityManager manages persistence contexts and entity instances.
The static keyword in Java is used for memory management and can be applied to variables, methods, blocks, and nested classes. Static variables and methods belong to the class rather than objects. A static variable is loaded when the class is loaded and there is only one copy per class, while instance variables are loaded each time an object is created. The main method must be static since it is called before any objects are created to start the program execution. Static blocks are used to initialize static variables and are executed when the class is loaded.
Doctrine MongoDB ODM is an object document mapper for PHP that provides tools for managing object persistence with MongoDB. It allows developers to work with MongoDB documents as objects and provides a query API and change tracking functionality to make common operations like inserting, updating, and deleting documents straightforward. Doctrine abstracts away the low-level MongoDB driver to allow developers to work with documents and references between documents using familiar object-oriented patterns.
El documento proporciona información sobre el rendimiento de crucero, ajuste de la mezcla de combustible, temperaturas del motor, pérdida de sustentación, recuperación de tirabuzones, descensos, aterrizajes, operación en tiempo frío y reducción de ruido para un Cessna T-210L. Explica cómo optimizar la velocidad de crucero, el rango y la economía de combustible mediante el ajuste de la altitud, las RPM y la mezcla de combustible.
This document discusses domain modeling in a functional world based on the speaker's real life experiences. The speaker covers topics like immutability and algebraic data types, updating domain models functionally using lenses, type classes for domain modeling, and managing states functionally. The speaker advocates for isolating pure domain logic from side effects to make the logic easier to test, reason about, and parallelize. Functional composition is emphasized as a way to build complex abstractions from simpler ones.
A struct in C# is a value type that can contain fields, methods, properties and other structs. It is useful for small data structures like Point, Rectangle, Color. Unlike classes, structs are allocated on the stack instead of the heap. Structs can implement interfaces but cannot inherit from other classes or be inherited by other classes. To declare a struct, use the struct keyword followed by the struct name and members. Struct objects are created using the new operator and members accessed using dot notation.
Functional Programming is preferred since it uses pure functions and values and keeps side effects at bay. However, while building real-life applications, side effects are often needed in the scenario when, say, one needs to query a database or read from or write to the stream.
If you’re facing this challenge in your projects too, then IO Monads can come to your rescue. Explore how using IO Monads, Scala developers can smoothly encapsulate side effects and write graceful programs while maintaining purity in Functional programming.
1. How to deal with side-effects in Scala in a purely functional way?
2. Important features like
a) Synchronous and asynchronous computations
b) Error handling
c) Concurrency
d) Parallelism
e) Cancellation
The document contains the source code for 7-10 experiments in an ASP.NET Software Technology Lab Manual. The experiments cover topics like using dropdown lists, listboxes, textbox events, radio buttons, validation in textboxes, and data list controls in ASP.NET. It also includes a longer experiment on performing CRUD (create, read, update, delete) operations on a student database using ADO.NET Entity Framework. The experiments provide the ASP.NET code and screenshots of the output for each program.
Este documento presenta una lista de abreviaturas y códigos utilizados en los Procedimientos para los Servicios de Navegación Aérea de la Organización de Aviación Civil Internacional. La lista contiene abreviaturas en inglés y su correspondiente traducción al español para términos relacionados con meteorología, navegación aérea, comunicaciones y gestión del tránsito aéreo. La séptima edición de este documento, publicada en 2007, reemplaza todas las ediciones anteriores.
MRI Conditional Pacemaker
This document discusses MRI conditional pacemakers and the process for patients with these devices to undergo MRI scans safely. It provides information on:
1) The components and basic principles of how MRI machines work to produce images.
2) How pacemaker systems were designed with solutions like minimizing ferromagnetic materials and optimizing circuitry to reduce interactions with the MRI's magnetic and radiofrequency fields.
3) Clinical study results demonstrating the safety and effectiveness of MRI conditional pacemakers, with no differences found in capture thresholds or sensed amplitudes before and after MRI scans.
4) Recommended patient care pathways for MRI scans including pre-screening, pre-scan preparation through programming the pacemaker,
The document discusses tween animation in Android. It explains that tween animation takes parameters like start/end values, duration, and rotation to animate an object. The Animation class is used to load animations from XML files using AnimationUtils. Example code shows how to create zoom in/out, rotate, and fade animations by defining XML files and starting the animations on a menu click.
Super keyword is a reference variable that is used for refer parent class object. Super keyword is used in java at three level, at variable level, at method level and at constructor level.
SQL functions allow users to perform calculations on data, modify individual data items, manipulate output for groups of rows, and format dates and numbers for display. Functions are divided into several groups including single row functions, aggregate functions, analytic functions, object reference functions, and user-defined functions. Single row functions can execute the same operation for every row retrieved by a query.
This document is an introduction to Getting Started with Grails, Second Edition. It will use a sample application called RaceTrack to demonstrate how to build a Grails application from scratch. Readers will learn about core Grails concepts like domain classes, controllers, views, validation, relationships and more by building out the RaceTrack application. The goal is to provide a running club a way to track races and runner registrations digitally by leveraging the Grails framework.
Enterprise PHP: mappers, models and servicesAaron Saray
One of the greatest failures PHP has is not that it is a bad language, but that it isn't marketed as a good language. Since it's so easy to do it bad, a lot of people do just that. However, there is hope. Businesses ARE using PHP for Enterprise! You just need to apply a solid foundation to the language to get to that Enterprise level.
With our mind on the Enterprise sphere, it's time to take PHP programming to a more advanced level. To get the most out of this talk, you should already be familiar with object oriented programming concepts in PHP. To begin with, I'll talk about the need for a service layer, data mappers, and business object models. Then I'll demonstrate examples of how to do it right. As an added bonus, I'm not going to just tell you why it's best practice and a "good idea" - I'm going to SHOW you. This might be the first time in your life that you realize that changes in architecture, supporting infrastructure, and business requirements don't have to be as painful as you once thought!
The slides of my talk at PUGRoma.
Here, a complete sample code
https://github.com/leopro/trip-planner
Presentation is also here: http://t.co/5EK56yYBmQ
Enterprise PHP Architecture through Design Patterns and Modularization (Midwe...Aaron Saray
Object Oriented Programming in enterprise level PHP is incredibly important. In this presentation, concepts like MVC architecture, data mappers, services, and domain and data models will be discussed. Simple demonstrations will be used to show patterns and best practices. In addition, using tools like Doctrine or integration with Salesforce or the AS/400 will also be discussed. There will be an emphasis on the practical application of these techniques as well - this isn't just a theoretical talk! This presentation is great for those just beginning to create enterprise applications as well as those who have had years of experience.
Rich domain model with symfony 2.5 and doctrine 2.5Leonardo Proietti
This document summarizes a presentation on building a rich domain model with Symfony2 and Doctrine2. It discusses modeling the domain by focusing on the problem space rather than the solution space. It emphasizes making the domain model ubiquitous by using a common language throughout the code and contexts. The presentation also covers using entities as both domain objects and persistence model objects, validating inputs and protecting invariants, and taking an iterative test-driven approach to developing the domain model.
As presented at Dutch PHP Conference 2015, an introduction to command buses, how to implement your own in PHP and why they're both useful but unimportant.
Symfony: Your Next Microframework (SymfonyCon 2015)Ryan Weaver
Microservices are a huge trend, and microframeworks are perfect for them: put together just a few files, write some code, and your done!
But Symfony is a big framework, right? Wrong! Symfony can be as small as a single file!
In this talk, we'll learn how to use Symfony as a micro-framework for your next project. Your app will stay small and clear, but without needing to give up the features or third-party bundles that you love. And if the project grows, it can evolve naturally into a full Symfony project.
So yes, Symfony can also be a microframework. Tell the world!
See all the steps involved to build a fully functional data mapper with object-oriented PHP5 using the power and simplicity of the Standard PHP Library. Based on the early development of a new PHP DataMapper project Vance Lucas started a few months ago as the Model layer for an MVC framework.
Anatomy of a Modern PHP Application Architecture AppDynamics
This document provides an overview of how to configure and use AppDynamics to monitor various aspects of a PHP application architecture, including error monitoring, SQL queries, HTTP requests, transactions, distributed transactions, external services, and more. It describes viewing and analyzing performance metrics, transactions, call graphs, and other diagnostic data to identify bottlenecks and issues. Configuration options are presented for instrumenting the PHP application, databases, queues, external APIs and other components to provide end-to-end performance monitoring of the distributed application.
Nobody wants to work in a large ball of mud that becomes harder to manage as time goes on. Proven software architectures tells us to break the system into more manageable components that are isolated from each other.
Years back (before Composer) in symfony1 era we had a single SVN repository, that required a lot of discipline to keep our codebase decoupled and clean. After migrating to Symfony 2 we broke the project into more manageable components that were in separate Git repositories. Unfortunately it quickly became a huge overhead and nightmare to deal with.
We learned the hard why that all the benefits come from having isolated packages not breaking things into separate repositories.
Now we have a single Git repository, again. This isn't a bad idea; to my knowledge Facebook, Twitter, and Google all have a big monolithic source repos but we needed a solution that works for a lot smaller fish :)
With a little help, Composer made this possible for us - so you can have your cake and eat it too!
This document provides an overview of key concepts in Domain-Driven Design (DDD) including the ubiquitous language, bounded contexts, value objects, entities, repositories, collections, mappers, identity maps, units of work, and services. It explains that DDD is a set of principles and patterns that help developers create elegant systems by focusing on the core domain and language of the business. It also emphasizes separating business processes into bounded contexts and using ubiquitous language consistently throughout the code.
In building large scale web applications MVC seems like a good solution in the initial design phase. However after having built a few large apps that have multiple entry points (web, cli, api etc) you start to find that MVC breaks down. Start using Domain Driven Design.
Domain-driven design (DDD) is an approach to software development for complex needs by connecting the implementation to an evolving model.[1] The premise of domain-driven design is the following:
Placing the project's primary focus on the core domain and domain logic.
Basing complex designs on a model of the domain.
Initiating a creative collaboration between technical and domain experts to iteratively refine a conceptual model that addresses particular domain problems.
Have more questions?
Twitter: @wajrcs
Web: http://waqaralamgir.tk
Software Design Patterns in Laravel by Phill SparksPhill Sparks
Laravel makes use of quite a few well-established design patterns that promote reusable object-oriented code. Together, we will investigate the design patterns used in the core of Laravel 4 and discuss how they encourage reusable software.
This document provides an overview of techniques for capturing and analyzing SQL queries in MySQL databases. It discusses built-in MySQL options like the slow query log, general query log, and binary log. It also covers other techniques like using MySQL Proxy, TCP/IP capture, Dtrace/SystemTap, and application management. Specific examples are provided for slow query log output, the general query log from WordPress, and the binary log and processlist.
The document outlines 7 things the author wishes someone had told him earlier in his programming career. They are to learn from everything, find someone smarter to mentor you, log everything for troubleshooting, test everything thoroughly, understand that as developers you provide customer service, there are two paths of development - innovation and stabilization, and to do something different occasionally to avoid burnout. The author shares this advice from his experience as a 20-year programmer and encourages others to pass on knowledge by mentoring others.
Handle complex POST/PATCH requests in RESTful APIfightmaster
The document discusses handling complex POST and PATCH requests in RESTful APIs. It describes a RESTful API called ProFIT that was created for a product fulfillment and information tracking system. The API has around 60 entities and 100 endpoints and supports GET, POST, PUT, PATCH requests. Examples are provided for GET requests to retrieve orders and their items, as well as POST and PATCH requests. The benefits of using data transfer objects and serialization libraries like JMSSerializerBundle and SimpleThingsFormSerializerBundle are covered. The presentation also discusses validation, authentication, testing, and best practices for building RESTful APIs with Symfony.
Mysqlnd, an unknown powerful PHP extensionjulien pauli
The document discusses mysqlnd, a PHP extension that replaces libmysql. Mysqlnd provides significant memory savings when processing result sets by avoiding duplicating result data in memory. It also includes detailed statistics collection and an extensible plugin architecture. Mysqlnd is now the default MySQL connector used by PHP.
This document discusses applying Clean Architecture principles to PHP applications. It introduces Uncle Bob and his work on Clean Architecture. It then provides examples of how Clean Architecture could be implemented in PHP, with separate layers for services, controllers, and resources. Links are also included for additional information on Clean Architecture and the presentation.
Learn about CANopen communication protocol.
Get to know the basic terms, DS402 profiles, network management, SDO, PDO and more.
Find out what are the advantages of distributed control?
What is the binary interpreter method?
Charla del PHP Day Spain, sobre como lidiar con Legacy Code. Se habla de UnitTesting, Refactoring. Ademas de como generar codigo de buena calidad con TDD y Clean Code.
Closing keynote, as presented at Codemotion 2014, LaraconEU 2014, Redevelop 2014, CodeConnexx 2013 and PHP North East 2014.
This presentation makes a reference to a reading list I received. For those interested, the release consists of most of the general classics, such as Gang Of Four "Design Patterns", The Pragmatic Programmer, Structure and Interpretation of Computer Programs, Domain Driven Design and a few others. The actual list remains tucked away in a box somewhere.
The document contains code for unit testing a PHP MVC application using PHPUnit. It includes:
- Code for the Todo model and its tests using PHPUnit assertions.
- Configuration for PHPUnit to run tests for the application and library.
- Tests for the IndexController using a Test_ControllerTestCase class with helper methods.
- Code for Request, Response and View classes to mock the MVC framework.
- A test to interact with the application interface using Selenium.
The document shows the project structure for an MVC application and library with tests. It demonstrates how to test models, controllers and the user interface using test doubles, assertions and helper methods in PHPUnit.
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
Dependency Injection (DI) is a fantastic technique, but what if you what to use dependency injection in your legacy application. Fear not! As someone who as done this very thing, I will show how you can successful and incrementally add DI to any application. I will present a number of recipes and solutions to common problems and give a tour of the various PHP DI projects and how they can help.
This session introduces most well known design patterns to build PHP classes and objects that need to store and fetch data from a relational databases. The session will describe the difference between of the Active Record, the Table and Row Data Gateway and the Data Mapper pattern. We will also examine some technical advantages and drawbacks of these implementations. This talk will expose some of the best PHP tools, which ease database interactions and are built on top of these patterns.
Software development is riddled with explicit and implicit costs. Every decision you make has a cost attached to it. When you're writing code, you're making an investment, the size of which will for a long time define the costs of your future growth. Making right decision about these investments is very tricky and the cost of wrong decisions might be crippling for both business and teams that support it.
Extreme Programming and Test Driven Development in particular are practices that are aiming at supporting development effort by making it easier to introduce change. That said, sometimes those tools can become a problem of its own when applied in the wrong way or for the wrong context. Understanding software cost forces is a very important skill of successful teams and something that helps understand how to apply XP and TDD in different contexts.
Why is crud a bad idea - focus on real scenariosDivante
This document discusses why CRUD (Create, Read, Update, Delete) is generally not a good approach for designing application code and APIs. It argues that entities should follow real business rules and scenarios rather than allowing arbitrary setting of attributes. Setters in particular are problematic as they don't map to real-world actions and don't enforce data integrity. The document recommends focusing on expressive methods that model real use cases rather than generic update operations. It also discusses how to add a CRUD layer on top of an internal domain model if needed while still maintaining encapsulation. The key takeaway is that applications should be designed around rich domain objects and real business behaviors rather than simple data access patterns.
This document discusses PHPSpec, a behavior-driven development (BDD) framework for PHP. It begins by explaining what PHPSpec is and how it implements BDD through a domain-specific language (DSL) based on RSpec. The document then covers how PHPSpec specifies tests using contexts, examples, expectations, matchers, mocks, and stubs. It provides examples of writing PHPSpec tests and using various PHPSpec features. The document concludes by mentioning upcoming PHPSpec features and linking to resources for learning more.
Replacing dependents with doubles is a central part of testing that every developer has to master. This talk goes over the different types of doubles and explains their place in testing, how to implement them in a mainstream mocking framework, and which strategies or doubles to use in different message exchange scenarios between objects. After this talk you will have moved a step forward in your understanding of testing in the context of object oriented programming.
Presentation of the command dispatcher pattern I made during one of the chapter meetings in HelloFresh.
Companion article: https://olvlvl.com/2018-04-command-dispatcher-pattern
Design Patterns avec PHP 5.3, Symfony et PimpleHugo Hamon
Cette conférence présente deux grands motifs de conception : l'observateur et l'injection de dépendance. Ce sujet allie à la fois théorie et pratique. Le composant autonome EventDispatcher de Symfony ainsi que le conteneur d'injection de dépendance Pimple sont mis à l'honneur avec des exemples pratiques d'usage. Ces cas pratiques combinent du code de l'ORM Propel ainsi que le composant autonome Zend\Search\Lucene du Zend Framework 2
This document describes the Database Abstraction Layer (DBTNG) introduced in Drupal 7. DBTNG provides a unified API for database queries that works across different database backends like MySQL, PostgreSQL, and SQLite. It supports both static and dynamic queries. Static queries use placeholders and prepared statements for security, while dynamic queries are built programmatically using a query builder object. Methods are provided for SELECT, INSERT, UPDATE, DELETE, and MERGE queries. Transactions and reading from slave databases are also supported.
This document discusses using a command bus architecture to handle application commands. It begins by showing an example controller action that updates a product entity, representing a "controller driven" approach. It then introduces concepts like separating application layers and using commands to capture user intent. Commands are defined as immutable message objects that are passed to command handlers for processing rather than calling controller methods directly. A single handler class is defined per command to focus processing logic in one place. The command bus is responsible for dispatching commands to their corresponding handlers. This shifts the application to being more intent-focused and decouples the layers.
Be lazy, be ESI: HTTP caching and Symfony2 @ PHPDay 2011 05-13-2011Alessandro Nadalin
In the first part of the presentation we see how Symfony2 implements HTTP cache.
In the second one there's an explanation of why application cache layers suck, why nerly every php application does caching in the less productive way and how you benefit from HTTP cache from this point of view.
Can't Miss Features of PHP 5.3 and 5.4Jeff Carouth
If you're like me you remember the days of PHP3 and PHP4; you remember when PHP5 was released, and how it was touted to change to your life. It's still changing and there are some features of PHP 5.3 and new ones coming with PHP 5.4 that will improve your code readability and reusability. Let's look at some touted features such as closures, namespaces, and traits, as well as some features being discussed for future releases.
Code smell is any symptom in the source code of a program that possibly indicates a deeper problem.
So let's see what are code smell we can remove from our code.
Your code sucks, let's fix it - DPC UnConRafael Dohms
How do you measure the quality of your code? Performance and testing are just one aspect of code, in order to meet deadlines and make maintenance quicker you also need your code to be readable, decoupled and generally easier to comprehend and work with. This talk will go over tips and exercises to help you identify trouble areas, refactor them and train you to write better code in future projects. Come make your code look and function better.
By the sum of PHPUnit assertion power and Symfony2 functional testing tools the developer can obtain a deep control on the developed application.
Here you can find some suggestions on how to leverage that power.
Semantic Cultivators : The Critical Future Role to Enable AIartmondano
By 2026, AI agents will consume 10x more enterprise data than humans, but with none of the contextual understanding that prevents catastrophic misinterpretations.
This is the keynote of the Into the Box conference, highlighting the release of the BoxLang JVM language, its key enhancements, and its vision for the future.
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungenpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-nomad-web-best-practices-und-verwaltung-von-multiuser-umgebungen/
HCL Nomad Web wird als die nächste Generation des HCL Notes-Clients gefeiert und bietet zahlreiche Vorteile, wie die Beseitigung des Bedarfs an Paketierung, Verteilung und Installation. Nomad Web-Client-Updates werden “automatisch” im Hintergrund installiert, was den administrativen Aufwand im Vergleich zu traditionellen HCL Notes-Clients erheblich reduziert. Allerdings stellt die Fehlerbehebung in Nomad Web im Vergleich zum Notes-Client einzigartige Herausforderungen dar.
Begleiten Sie Christoph und Marc, während sie demonstrieren, wie der Fehlerbehebungsprozess in HCL Nomad Web vereinfacht werden kann, um eine reibungslose und effiziente Benutzererfahrung zu gewährleisten.
In diesem Webinar werden wir effektive Strategien zur Diagnose und Lösung häufiger Probleme in HCL Nomad Web untersuchen, einschließlich
- Zugriff auf die Konsole
- Auffinden und Interpretieren von Protokolldateien
- Zugriff auf den Datenordner im Cache des Browsers (unter Verwendung von OPFS)
- Verständnis der Unterschiede zwischen Einzel- und Mehrbenutzerszenarien
- Nutzung der Client Clocking-Funktion
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersToradex
Toradex brings robust Linux support to SMARC (Smart Mobility Architecture), ensuring high performance and long-term reliability for embedded applications. Here’s how:
• Optimized Torizon OS & Yocto Support – Toradex provides Torizon OS, a Debian-based easy-to-use platform, and Yocto BSPs for customized Linux images on SMARC modules.
• Seamless Integration with i.MX 8M Plus and i.MX 95 – Toradex SMARC solutions leverage NXP’s i.MX 8 M Plus and i.MX 95 SoCs, delivering power efficiency and AI-ready performance.
• Secure and Reliable – With Secure Boot, over-the-air (OTA) updates, and LTS kernel support, Toradex ensures industrial-grade security and longevity.
• Containerized Workflows for AI & IoT – Support for Docker, ROS, and real-time Linux enables scalable AI, ML, and IoT applications.
• Strong Ecosystem & Developer Support – Toradex offers comprehensive documentation, developer tools, and dedicated support, accelerating time-to-market.
With Toradex’s Linux support for SMARC, developers get a scalable, secure, and high-performance solution for industrial, medical, and AI-driven applications.
Do you have a specific project or application in mind where you're considering SMARC? We can help with Free Compatibility Check and help you with quick time-to-market
For more information: https://www.toradex.com/computer-on-modules/smarc-arm-family
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxAnoop Ashok
In today's fast-paced retail environment, efficiency is key. Every minute counts, and every penny matters. One tool that can significantly boost your store's efficiency is a well-executed planogram. These visual merchandising blueprints not only enhance store layouts but also save time and money in the process.
Big Data Analytics Quick Research Guide by Arthur MorganArthur Morgan
This is a Quick Research Guide (QRG).
QRGs include the following:
- A brief, high-level overview of the QRG topic.
- A milestone timeline for the QRG topic.
- Links to various free online resource materials to provide a deeper dive into the QRG topic.
- Conclusion and a recommendation for at least two books available in the SJPL system on the QRG topic.
QRGs planned for the series:
- Artificial Intelligence QRG
- Quantum Computing QRG
- Big Data Analytics QRG
- Spacecraft Guidance, Navigation & Control QRG (coming 2026)
- UK Home Computing & The Birth of ARM QRG (coming 2027)
Any questions or comments?
- Please contact Arthur Morgan at [email protected].
100% human made.
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxshyamraj55
We’re bringing the TDX energy to our community with 2 power-packed sessions:
🛠️ Workshop: MuleSoft for Agentforce
Explore the new version of our hands-on workshop featuring the latest Topic Center and API Catalog updates.
📄 Talk: Power Up Document Processing
Dive into smart automation with MuleSoft IDP, NLP, and Einstein AI for intelligent document workflows.
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul
Artificial intelligence is changing how businesses operate. Companies are using AI agents to automate tasks, reduce time spent on repetitive work, and focus more on high-value activities. Noah Loul, an AI strategist and entrepreneur, has helped dozens of companies streamline their operations using smart automation. He believes AI agents aren't just tools—they're workers that take on repeatable tasks so your human team can focus on what matters. If you want to reduce time waste and increase output, AI agents are the next move.
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPathCommunity
Join this UiPath Community Berlin meetup to explore the Orchestrator API, Swagger interface, and the Test Manager API. Learn how to leverage these tools to streamline automation, enhance testing, and integrate more efficiently with UiPath. Perfect for developers, testers, and automation enthusiasts!
📕 Agenda
Welcome & Introductions
Orchestrator API Overview
Exploring the Swagger Interface
Test Manager API Highlights
Streamlining Automation & Testing with APIs (Demo)
Q&A and Open Discussion
Perfect for developers, testers, and automation enthusiasts!
👉 Join our UiPath Community Berlin chapter: https://community.uipath.com/berlin/
This session streamed live on April 29, 2025, 18:00 CET.
Check out all our upcoming UiPath Community sessions at https://community.uipath.com/events/.
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...Alan Dix
Talk at the final event of Data Fusion Dynamics: A Collaborative UK-Saudi Initiative in Cybersecurity and Artificial Intelligence funded by the British Council UK-Saudi Challenge Fund 2024, Cardiff Metropolitan University, 29th April 2025
https://alandix.com/academic/talks/CMet2025-AI-Changes-Everything/
Is AI just another technology, or does it fundamentally change the way we live and think?
Every technology has a direct impact with micro-ethical consequences, some good, some bad. However more profound are the ways in which some technologies reshape the very fabric of society with macro-ethical impacts. The invention of the stirrup revolutionised mounted combat, but as a side effect gave rise to the feudal system, which still shapes politics today. The internal combustion engine offers personal freedom and creates pollution, but has also transformed the nature of urban planning and international trade. When we look at AI the micro-ethical issues, such as bias, are most obvious, but the macro-ethical challenges may be greater.
At a micro-ethical level AI has the potential to deepen social, ethnic and gender bias, issues I have warned about since the early 1990s! It is also being used increasingly on the battlefield. However, it also offers amazing opportunities in health and educations, as the recent Nobel prizes for the developers of AlphaFold illustrate. More radically, the need to encode ethics acts as a mirror to surface essential ethical problems and conflicts.
At the macro-ethical level, by the early 2000s digital technology had already begun to undermine sovereignty (e.g. gambling), market economics (through network effects and emergent monopolies), and the very meaning of money. Modern AI is the child of big data, big computation and ultimately big business, intensifying the inherent tendency of digital technology to concentrate power. AI is already unravelling the fundamentals of the social, political and economic world around us, but this is a world that needs radical reimagining to overcome the global environmental and human challenges that confront us. Our challenge is whether to let the threads fall as they may, or to use them to weave a better future.
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Aqusag Technologies
In late April 2025, a significant portion of Europe, particularly Spain, Portugal, and parts of southern France, experienced widespread, rolling power outages that continue to affect millions of residents, businesses, and infrastructure systems.
Mobile App Development Company in Saudi ArabiaSteve Jonas
EmizenTech is a globally recognized software development company, proudly serving businesses since 2013. With over 11+ years of industry experience and a team of 200+ skilled professionals, we have successfully delivered 1200+ projects across various sectors. As a leading Mobile App Development Company In Saudi Arabia we offer end-to-end solutions for iOS, Android, and cross-platform applications. Our apps are known for their user-friendly interfaces, scalability, high performance, and strong security features. We tailor each mobile application to meet the unique needs of different industries, ensuring a seamless user experience. EmizenTech is committed to turning your vision into a powerful digital product that drives growth, innovation, and long-term success in the competitive mobile landscape of Saudi Arabia.
Mobile App Development Company in Saudi ArabiaSteve Jonas
Models and Service Layers, Hemoglobin and Hobgoblins
1. Surgeon General's Warning
This talk is clocked at 1 slide per 12.8 seconds and features unsafe
amounts of code. Presenter is a registered Class 3 Fast Talker (equal
to 1 Gilmore Girls episode).
Viewing is not recommended for those hungover, expected to become
hungover or consuming excessive amounts of caffeine. Do not watch
and operate motor vehicles.
If you accidentally consume this talk, flush brain with kitten pictures
and seek emergency help in another talk. No hard feelings, seriously.
It's almost the end of the conference, after all. Why are we even here?
Notice in accordance with the PHP Disarmament Compact of 1992. Void where prohibited.
2. Models & Service Layers
Hemoglobin & Hobgoblins
ZendCon 2014
Ross Tuck
10. Model
class TodoList {
function setName($name);
function getName();
function setStatus($status);
function getStatus();
function addTask($task);
function setTasks($tasks);
function getTasks();
}
13. “In essence the problem with anemic domain
models is that they incur all of the costs of a
domain model, without yielding any of the
benefits.”
-Martin Fowler
23. Model
class TodoList {
function setName($name);
function getName();
function setStatus($status);
function getStatus();
function addTask($task);
function setTasks($tasks);
function getTasks();
}
24. Model
class Task {
function setDescription($desc);
function getDescription();
function setPriority($priority);
function getPriority();
}
25. An ORM that's not Doctrine 2.
A framework that's not Symfony2.
I promise.
37. • Service Layer
• Service Container
• Web Service
• Service Oriented Architecture
• Domain Service
• Stateless Service
• Software-as-a-service
• Platform-as-a-service
• Whatever-as-a-service meme
• Delivery Service
• Laundry Service
58. Service
class TodoService {
function findById($id) {
$todo = $this->repository->findById($id);
if (!$todo) {
throw new TodoNotFoundException();
}
return $todo;
}
}
not http exception
66. Service
class TodoService {
public function findLatestLists() {
return $this->repository->findLatestLists();
}
}
67. Service
class TodoService {
public function findLatestLists() {
if ($this->cache->has('latest:lists')) {
return $this->cache->get('latest:lists');
}
$results = $this->repository->findLatestLists();
$this->cache->set('latest:lists', $results);
return $results;
}
}
74. Model
class TodoList {
function setName($name);
function getName();
function setStatus($status);
function getStatus();
function setTasks($tasks);
function getTasks();
}
76. Model
class TodoList {
function setName($name);
function getName();
function setStatus($status);
function getStatus();
function setTasks($tasks);
function getTasks();
}
Where's mah logic?
77. Service
class TodoListService {
function addTask(TodoList $list, $desc, $priority) {
$task = new Task();
$task->setDescription($desc);
$task->setPriority($priority);
$task->setTodoList($list);
$this->repository->save($task);
$this->auditLog->logNewTask($task);
$this->mailer->sendMessage('New thingy!');
}
}
79. “Organizes business logic by procedures
where each procedure handles a single
request from the presentation.”
-Fowler
94. Service
class TodoService {
function findById($id) {
$todo = $this->repository->findById($id);
if (!$todo) {
throw new TodoNotFoundException();
}
return $todo;
}
}
96. Repository
class TodoDbRepository implements TodoRepository {
public function findById($id) {
$todo = $this->db->select(...);
if (!$todo) {
throw new TodoNotFoundException();
}
return $todo;
}
}
97. Repository
class TodoDbRepository implements TodoRepository {
public function findById($id) {
$todo = $this->db->select(...);
if (!$todo) {
throw new TodoNotFoundException();
}
return $todo;
}
}
raw db connection
98. Repository
class TodoDbRepository implements TodoRepository {
public function findById($id) {
$todo = $this->repository->find($id);
if (!$todo) {
throw new TodoNotFoundException();
}
return $todo;
}
}
FIXED
100. Repository
interface EntityRepository {
public function createQueryBuilder($alias);
public function createResultSetMappingBuilder($alias);
public function createNamedQuery($queryName);
public function createNativeNamedQuery($queryName);
public function clear();
public function find($id, $lockMode, $lockVersion);
public function findAll();
public function findBy($criteria, $orderBy, $limit, $offset);
public function findOneBy($criteria, $orderBy);
public function __call($method, $arguments);
public function getClassName();
public function matching(Criteria $criteria);
}
102. Service
class TodoService {
function findById($id) {
$todo = $this->repository->findById($id);
if (!$todo) {
throw new TodoNotFoundException();
}
return $todo;
}
}
104. Service
class TodoService {
public function findLatestLists() {
if ($this->cache->has('latest:lists')) {
return $this->cache->get('latest:lists');
}
$results = $this->repository->findLatestLists();
$this->cache->set('latest:lists', $results);
return $results;
}
}
105. Repository
class TodoDbRepository implements TodoRepository {
public function findLatestLists() {
if ($this->cache->has('latest:lists')) {
return $this->cache->get('latest:lists');
}
$results = $this->repository->query(...);
$this->cache->set('latest:lists', $results);
return $results;
}
}
106. Repository Decorator Decorator object
class CachingTodoRepository implements TodoRepository {
public function findLatestLists() {
if ($this->cache->has('latest:lists')) {
return $this->cache->get('latest:lists');
}
$results = $this->innerRepository->findLatestLists();
$this->cache->set('latest:lists', $results);
return $results;
}
}
TodoDbRepository
107. DI Layer
new TodoService(
new CachingTodoRepository(
new TodoDbRepository(
$entityManager->getRepository('TodoList')
)
)
)
131. Service
class TodoListService {
function addTask(TodoList $list, $desc, $priority) {
$task = new Task();
$task->setDescription($desc);
$task->setPriority($priority);
$task->setTodoList($list);
$this->repository->save($task);
$this->auditLog->logNewTask($task);
$this->mailer->sendMessage('New thingy!');
}
}
132. Model
class TodoList {
function addTask(Task $task) {
$this->tasks[] = $task;
}
}
133. Model
class TodoList {
function addTask($desc, $priority) {
$task = new Task();
$task->setDescription($desc);
$task->setPriority($priority);
$this->tasks[] = $task;
}
}
134. Model
class TodoList {
function addTask($desc, $priority) {
$task = new Task($desc, $priority);
$this->tasks[] = $task;
}
}
135. Model
class TodoList {
function addTask($desc, $priority) {
$task = new Task($desc, $priority, $this);
$this->tasks[] = $task;
}
}
ORM allowance
136. Model
class TodoList {
function addTask($desc, $priority) {
$task = new Task($desc, $priority);
$this->tasks[] = $task;
}
}
137. Service
class TodoListService {
function addTask(TodoList $list, $desc, $priority) {
$list->addTask($desc, $priority);
$this->repository->save($list);
$this->auditLog->logNewTask($task);
$this->mailer->sendMessage('New thingy!');
}
}
138. Model
class TodoList {
function addTask($desc, $priority) {
$task = new Task($desc, $priority);
$this->tasks[] = $task;
}
}
139. Model
class TodoList {
function addTask($desc, $priority) {
$task = new Task($desc, $priority);
$this->tasks[] = $task;
if (count($this->tasks) > 10) {
$this->status = static::UNREALISTIC;
}
}
}
166. Model
function addTask($desc, $priority) {
$task = new Task($desc, $priority, $this);
$this->tasks[] = $task;
$this->raise(
new TaskAddedEvent($this->id, $desc, $priority)
);
if (count($this->tasks) > 10) {
$this->status = static::UNREALISTIC;
$this->raise(new WasTooAmbitiousEvent($this->id));
}
}
Logic is here!
167. Service
class TodoListService {
protected $dependency1;
protected $dependency2;
protected $dependency3;
protected $dependency4;
protected $dependency5;
protected $dependency6;
}
Big ball of mud
in the making
168. Event Listeners
class EmailListener {
function onTaskAdded($event) {
$taskName = $event->task->getName();
$this->mailer->sendMessage('New thingy: '.$taskName);
}
function onUserRegistered($event) {
$this->mailer->sendMessage('welcome sucka!');
}
}
Thin. Easy to test
189. Service
class TodoService {
function findById($id) {
$todoList = $this->repository->findById($id);
return $todoList;
}
}
190. Service
class TodoService {
function findById($id) {
$todoList = $this->repository->findById($id);
return new TodoDTO($todoList);
}
}
191. TodoDTO
class TodoDTO {
public function getName();
public function getStatus();
public function getMostRecentTask();
}
193. Service
class TodoService {
function generateReport() {
$data = $this->repository->performSomeCrazyQuery();
return new AnnualGoalReport($data);
}
}
211. Handler
class TodoListHandler {
function handleAddTask($cmd) {
$list = $this->repository->findById($cmd->todoListId);
$list->addTask($cmd->description, $cmd->priority);
}
function handleCompleteTask($command)
function handleRemoveTask($command)
}
215. Service
class ValidatingCommandBus implements CommandBus {
function execute($command) {
if (!$this->validator->isValid($command)) {
throw new InvalidCommandException();
}
$this->innerCommandBus->execute($command);
}
}
232. Write Model
class TodoListModel {
function rename($name);
function addTask($desc, $priority);
}
Read Model
class TodoListView {
function getName();
function getTasks();
}
234. Model
class TodoList {
function rename($name);
function addTask($desc, $priority);
function getName();
function getTasks();
function getParticipatingUsers();
}
235. Write Model
class TodoListModel {
function rename($name);
function addTask($desc, $priority);
}
Read Model
class TodoListView {
function getName();
function getTasks();
function getParticipatingUsers();
}
236. Write Model
class TodoListModel {
function rename($name);
function addTask($desc, $priority);
}
Read Model
class TodoListView {
function getName();
function getTasks();
function getParticipatingUsers();
}
ORM entity
1 Model
SQL query
N Models
242. Handler
class TodoListHandler {
function handleAddTask($cmd) {
$list = $this->repository->findById($cmd->todoListId);
$list->addTask($cmd->description, $cmd->priority);
}
}
243. Service
class TodoListService {
public function findByUser(User $user) {
return $this->repository->findByUser($user);
}
}
244. Handler
class TodoListHandler {
Service
class TodoListService {
public function findByUser(User $user) {
return $this->repository->findByUser($user);
}
}
function handleAddTask($cmd) {
$list = $this->repository->findById($cmd->todoListId);
$list->addTask($cmd->description, $cmd->priority);
}
}
246. $todoList = new TodoList();
$this->repository->save($todoList);
$todoList->getId();
Controller
247. $command = new CreateTodoCommand(UUID::create());
$commandBus->execute($command);
$command->uuid;
Controller