Home Page Icon
Home Page
Table of Contents for
Serialized LOB with Doctrine
Close
Serialized LOB with Doctrine
by Keyvan Akbary, Christian Soronellas, Carlos Buenosvinos
Domain-Driven Design in PHP
Foreword
Acknowledgments
Dedication
Preface
Who Should Read This Book
DDD and PHP Community
Summary of Chapters
Chapter 1: Getting Started with Domain-Driven Design
Chapter 2: Architectural Styles
Chapter 3: Value Objects
Chapter 4: Entities
Chapter 5: Domain Services
Chapter 6: Domain-Events
Chapter 7: Modules
Chapter 8: Aggregates
Chapter 9: Factories
Chapter 10: Repositories
Chapter 11: Application
Chapter 12: Integrating Bounded Contexts
Appendix: Hexagonal Architecture with PHP
Code and Examples
Getting Started with Domain-Driven Design
Why Domain-Driven Design Matters
The Three Pillars of Domain-Driven Design
Ubiquitous Language
Event Storming
Considering Domain-Driven Design
The Tricky Parts
Strategical Overview
Related Movements: Microservices and Self-Contained Systems
Wrap-Up
Architectural Styles
The Good Old Days
Layered Architecture
Model-View-Controller
Example of Layered Architecture
The View
The Controller
Inverting Dependencies: Hexagonal Architecture
The Dependency Inversion Principle (DIP)
Applying Hexagonal Architecture
Command Query Responsibility Segregation (CQRS)
The Write Model
The Read Model
Synchronizing the Write Model with the Read Model
Event Sourcing
Wrap-Up
Value Objects
Definition
Value Object vs. Entity
Currency and Money Example
Characteristics
Measures, Quantifies, or Describes
Immutability
Conceptual Whole
Value Equality
Replaceability
Side-Effect-Free Behavior
Basic Types
Testing Value Objects
Persisting Value Objects
Persisting Single Value Objects
Embedded Value with an Ad Hoc ORM
Embedded Value (Embeddables) with Doctrine >= 2.5.*
Embedded Value with Doctrine <= 2.4.*
Serialized LOB and Ad Hoc ORM
Improved Serialization with JMS Serializer
Serialized LOB with Doctrine
Doctrine Object Mapping Type
Doctrine Custom Types
Persisting a Collection of Value Objects
Collection Serialized into a Single Column
Collection Backed by a Join Table
Collection Backed by a Join Table with Doctrine
Collection Backed by a Join Table with an Ad Hoc ORM
Collection Backed by a Database Entity
NoSQL
PostgreSQL JSONB and MySQL JSON Type
Security
Wrap-Up
Entities
Introduction
Objects Vs. Primitive Types
Identity Operation
Persistence Mechanism Generates Identity
Surrogate Identity
Active Record Vs. Data Mapper for Rich Domain Models
Client Provides Identity
Application Generates Identity
Other Bounded Context Generates Identity
Persisting Entities
Setting Up Doctrine
Mapping Entities
Mapping Entities Using Annotated Code
Mapping Entities Using XML
Mapping Entity Identity
Final Mapping File
Testing Entities
DateTimes
Passing All Dates as Parameters
Test Class
External Fake
Reflection
Validation
Attribute Validation
Entire Object Validation
Decoupling Validation Messages
Validating Object Compositions
Entities and Domain Events
Wrap-Up
Services
Application Services
Domain Services
Domain Services and Infrastructure Services
An Issue of Code Reuse
Testing Domain Services
Anemic Domain Models Vs Rich Domain Models
Anemic Domain Model Breaks Encapsulation
Anemic Domain Model Brings a False Sense of Code Reuse
How to Avoid Anemic Domain Models
Wrap-Up
Domain-Events
Introduction
Definition
Short Story
Metaphor
Real-World Example
Characteristics
Naming Conventions
Domain Events and Ubiquitous Language
Immutability
Modeling Events
Doctrine Events
Persisting Domain Events
Event Store
Publishing Events from the Domain Model
Publishing a Domain Event from an Entity
Publishing your Domain Events from Domain or Application Services
How the Domain Event Publisher Works
Setting Up DomainEventListeners
Testing Domain Events
Spreading the news to Remote Bounded Contexts
Messaging
Syncing Domain Services with REST
Wrap-Up
Modules
General Overview
Leverage Modules in PHP
First-Level Namespacing
PEAR-Style Namespacing
PSR-0 and PSR-4 Namespacing
Bounded Contexts and Applications
Structuring Code in Modules
Design Guidelines
Modules in the Infrastructure Layer
Mixing Different Technologies
Modules in the Application Layer
Wrap-Up
Aggregates
Introduction
Key Concepts
ACID
Transactions
Isolation Levels
Referential Integrity
Locking
Concurrency
Pessimistic Concurrency Control (PCC)
With Doctrine
Optimistic Concurrency Control
With Elasticsearch
With Doctrine
What Is an Aggregate?
What Martin Fowler Says...
What Wikipedia Says...
Why Aggregates?
A Bit of History
Anatomy of an Aggregate
Aggregate Design Rules
Design Aggregates Based in Business True Invariants
Small Aggregates Vs. Big Aggregates
Reference Other Entities by Identity
Modify One Aggregate Per Transaction and Request
Sample Application Service: User and Wishes
No Invariant, Two Aggregates
No More Than Three Wishes Per User
Pessimistic Concurrency Control
Optimistic Concurrency Control
Transactions
Wrap Up
Factories
Factory Method on Aggregate Root
Forcing Invariants
Factory on Service
Building Specifications
Building Aggregates
Testing Factories
Object Mother
Test Data Builder
Wrap-Up
Repositories
Definition
Repositories Are Not DAOs
Collection-Oriented Repositories
In-Memory Implementation
Doctrine ORM
Object Mapping
Doctrine Custom Mapping Types
Entity Manager
DQL Implementation
Persistence-Oriented Repository
Redis Implementation
SQL Implementation
Extra Behavior
Querying Repositories
Specification Pattern
In-Memory Implementation
SQL Implementation
Managing Transactions
Testing Repositories
Testing Your Services with In-Memory Implementations
Wrap-Up
Application
Requests
Building Application Service Requests
Request Design
Use Primitives
Serializable
No Business Logic
No Tests
Anatomy of an Application Service
Dependency Inversion
Instantiating Application Services
Customize an Application Service
Execution
One Class Per Application Service
Multiple Application Service Methods per Class
Returning Values
DTO from Aggregate Instances
Data Transformers
Multiple Application Services on Compound Layouts
AJAX Content Integration
ESI Content Integration
Symfony Sub Requests
One Controller, Multiple Application Services
Testing Application Services
Transactions
Security
Domain Events
Command Handlers
Tactician Library and Other Options
Wrap-Up
Integrating Bounded Contexts
Integration Through the Data Store
Integration Relationships
Separate Ways
Conformist
Implementing Bounded Context Integrations
Modern RPC
Message Queues
Wrap-Up
Hexagonal Architecture with PHP
Introduction
First Approach
Repositories and the Persistence Edge
Decoupling Business and Persistence
Migrating our Persistence to Redis
Decouple Business and Web Framework
Rating an Idea Using the API
Console App Rating
Testing Rating an Idea UseCase
Testing Infrastructure
Arggg, So Many Dependencies!
Domain Services and Notification Hexagon Edge
Let's Recap
Hexagonal Architecture
Key Points
What's Next?
Bibliography
The End
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Improved Serialization with JMS Serializer
Next
Next Chapter
Doctrine Object Mapping Type
Serialized LOB with Doctrine
In Doctrine, there are different ways of serializing objects in order to eventually persist them.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset