Chapter 3. Working with Databases
To forget one's purpose is the commonest form of stupidity.
WHAT'S IN THIS CHAPTER?
Understanding various approaches to object-relational mapping (ORM).
Configuring different database engines.
Writing schemas of object models.
Using the command-line interface.
In order to produce your first application, you need to know how to communicate with your database. To communicate with it, the database must be configured properly for use with your framework. And before the configuration can be made, you should know how the frameworks join with database systems and perhaps choose your preferred object-relational mapping (ORM) solution.
To help you with that before you move to coding the sample app, this chapter takes a close look at the ORM concept, which is essential for almost every PHP framework available. The rest of the chapter covers configuring various databases for chosen ORM solutions and how to communicate with them efficiently. In the next chapter, you will write an address book example in each framework. The good thing is that with ORM support, communicating with databases is really straightforward. You no longer need to write lengthy SQL queries manually nor join tables each time you need to call another object by reference. So this little bit of overhead is certainly worth the effort.
OBJECT-RELATIONAL MAPPING
ORM is one of the core concepts of PHP frameworks. It creates an abstraction layer between relational database management ...
Get Building PHP Applications with Symfony™, CakePHP, and Zend® Framework now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.