Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
WebApp development with Doctrine
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Radosław Zagórski
April 26, 2018
Programming
40
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
WebApp development with Doctrine
WebApp development with Doctrine
Radosław Zagórski
April 26, 2018
More Decks by Radosław Zagórski
See All by Radosław Zagórski
Queuing in PHP
rzagorski
0
41
Introducing to REST with Symfony 3
rzagorski
0
140
Other Decks in Programming
See All in Programming
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
930
[2026-09-26]空論ジェネリックプロセス~テスト資産とAIで紡ぐ、再現可能なパフォーマンスチューニングの話~
tosite
0
270
Agents on Rails - Rails at Scale 2026
irinanazarova
0
560
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
120
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
180
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
140
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
re:Inventに行く前に知っておきたい現地参加のノウハウ
nokomoro3
0
430
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
220
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
460
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Automating Front-end Workflow
addyosmani
1369
210k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
630
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Side Projects
sachag
456
43k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
780
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
Six Lessons from altMBA
skipperchong
29
4.5k
What's in a price? How to price your products and services
michaelherold
247
13k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
Transcript
Radosław Zagórski www.linkedin.com/in/radoslawzagorski
WebApp development with doctrine
What is Doctrine? A group of persistence-oriented libraries for PHP
Doctrine Project • Common • Annotations • Cache • Collections
• Lexer • Migrations • MongoDB Abstraction Layer • MongoDB Object Document Mapper • PHPCR ODM • Inflector • Object Relational Mapper • Database Abstraction Layer (DBAL)
Inflector
Database Abstraction Layer (DBAL)
Database Abstraction Layer (DBAL)
Database Abstraction Layer (DBAL)
Database Abstraction Layer (DBAL)
Object Relational Mapper
Object Relational Mapper
KNOW YOUR TOOLS https://www.doctrine-project.org/projects.html
What is Doctrine ORM for? • OLTP - Online Transaction
Processing • DDD • Fast prototyping • Object Oriented at first
What is Doctrine ORM not for? • Dynamic data structures
• Reporting • Statistics
entities should work without the ORM entities should work without
the DB
the database is just saving things
design entities first define mappings after designing the entities define
the database after modeling you domain
None
entities are not typed arrays
entities have behaviour
None
remember about the LOD
None
None
More expressive Easier to test Less coupling More flexible Easier
to refactor
disallow collection access from outside the entity
None
keep collection hidden in you entities
None
entities should always be valid invalid state should be in
a different object (use DTO)
None
avoid setters
don’t use lifecycle callbacks
avoid coupling with the application layer
None
form components break entity validity
avoid auto-generated identifiers
Avoid auto-generated identifiers your db operations will block each other
you are denying bulk inserts you cannot make multi-request transactions your object is invalid until saved your object does not work without the DB
ramsey/uuid
AUTO_INCREMENT IS ABUSED FOR SORTING Are you looking for a
DATETIME field instead?
favour immutable entities
None
Immutable data is simple Immutable data is cacheable (forever) Immutable
data is predictable Immutable data enables historical analysis
You may want to look at Event Sourcing… (https://github.com/prooph/event-sourcing)
avoid soft-deletes
Soft Deletes come from an era where keeping everything in
a single DB was required
break data integrity break immutability break validity
Annotations? XML? YAML? Mapping Driver
Lazy Loading or Eager Loading? Extra Lazy Loading?
use custom repositories
None
query functions are better
None
Separate MyRepository#get() and MyRepository#find()
MyRepository#find() can return null MyRepository#get() cannot return null
None
using a get() method that throws, you can simplify error
logic
DO NOT NORMALIZE DB WITHOUT A NEED FOR IT
CONSIDER USING SEPARATE DBS Transactional Data != Reporting
Data
doctrine paginator isn’t perfect
None
choosing Doctrine does not require you to go all in
you can implement 80% of your use cases with Doctrine
in a sane way.
None
Thank you!