This is a set of slides purely for presentation along with my talk on "Understanding Doctrine" at True North PHP 2013.
The content of the presentation is available at https://github.com/shiroyuki/trphp13-demo/blob/master/notes/speaker-note.md.
2. Today’s Menu
•
•
•
•
•
What is object relational
mapping?
How is Doctrine designed?
Change Tracking Policy
Proxies and Lazy loading
DBAL or ORM?
•
•
•
•
•
•
Cascading
Doctrine Event System
Second Level Cache
Metadata Cache*
Query Cache*
Result Cache*
15. This means
EntityManager’s persist method is disregarded and
everything reachable/managed by the entity manager,
including an initialized proxy, will be persisted
automatically.
19. This means
the code has full control to explicitly tell UnitOfWork
whether or not the entity is updated.
!
So, even if there is an update, the change can be
discarded as the notify method says there is no change.
23. Suppose you have m entities, named a1, a2, ...
and am. During the course of code execution,
we make a lot of queries. Each query makes at
least one proxy per entity in the result set.
Hence, the number of proxies will be around
c×m proxies.
24. Beside retrieving the ID of the proxy, retrieving or
defining properties of a proxy always triggers the
proxy loading if the proxy is set for lazy loading.
!
In this situation, it might lead to making around
cm queries by the end of the execution.
29. SELECT PARTIAL u.{id, name}
FROM User u
WHERE u.id = :id
or
SELECT PARTIAL u.{id, name},
PARTIAL g.{id, name}
FROM User u
JOIN u.groups g
WHERE u.id = :id