Using Direct SQL

So far we have learned how Magento data models and ORM systems provide a clean and simple way to access, store, and manipulate our data. Before we jump right into this section and learn about the Magento database adapters and how to run raw SQL queries, I feel it is important that we understand why you should avoid using what you are about to learn in this section as much as possible.

Magento is an extremely complex system, and as we've also learned in the previous chapter, a framework driven in part by events. Just saving a product will trigger half a dozen different events, each doing a different task. This will not happen if you decide to just create a query and update a product directly. So, as developers, we must be extremely ...

Get Magento PHP Developer's Guide - Second Edition 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.