13 PHP MVC Frameworks ORM Basics
13 PHP MVC Frameworks ORM Basics
2
ORM BASICS - DOCTRINE
4
What Is ORM?
Doctrine ORM
• Doctrine Entity
Doctrine ORM
• Doctrine Entity
– Doctrine entities should only represent database table
structure
– Do not execute SQL queries from your entities
– Do not write heavy logic in your entity classes
Doctrine DBAL
• Doctrine Query
Language – DQL
• Very similar to SQL
• With DQL we can
update, delete, select
entities, but not persist
• With DQL we select
objects instead of table
rows
Entity Manager
• Extending
ServiceEntityRepository
allows us to access dynamic
helper methods for each
mapped entity property
• Now you have dynamic
method names for our entity
properties without writing
single line of code
Entity Repository Class
• Doctrine ORM
• Basic entity mapping
• DBAL
• Entity Repository
25