~/talk

Doctrine ORM good practices and tricks

Talkat PHP Serbia Conference 2016 · 2016-05-28..05-29· [php, databases]
slides:none on file

Start from domain entities and behavior not tables: design valid, immutable objects with named constructors, DTOs for multi-step forms, and no setters, immutable valid entities. Avoid lifecycle callbacks for business logic, avoid eager/extra‑lazy and bidirectional associations, and prefer annotations for private packages, XML for public. Use use UUIDs instead of autoincrement (claim: generating 100 UUIDs/sec for 100 years still yields only ~50% collision risk), prefer append‑only events for history, inject repositories (don’t extend Doctrine base), and try Doctrine 2.5’s second‑level cache.

AI-written summary · about

  1. 0:00Introduction and speaker background
  2. 3:11When to use ORM and its limitations
  3. 8:33Designing entities first
  4. 15:34Law of Demeter and entity coupling
  5. 20:41Entity validity and DTOs
  6. 24:55Avoiding framework dependencies
  7. 28:07Lifecycle callbacks and auto-increment issues
  8. 32:25Using UUIDs instead of auto-increment
  9. 36:44Immutable entities and event sourcing
  10. 39:58Soft deletes and domain concepts
  11. 43:39Mapping driver choice
  12. 45:08Lazy loading and bidirectional associations
  13. 47:38Custom repositories and query functions
  14. 51:36Transaction management and entity manager
  15. 53:44Normalization and database design
  16. 54:44Performance profiling and optimization
  17. 55:48Recap and key takeaways
  18. 57:15Q&A session
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.