I am little bit confuse. I am using magento orm basic like Mage::getModel('test/test')
and I search that also use direct SQL query use for insert,update and delete so my question is which one is better and if I use direct SQL query so any arise security issue in future or secure direct SQL query in magento ? Which one is better both of them ? Please guide me
Add a comment
|
1 Answer
There is no problem about using direct SQL queries, if you are 100% sure which database tables you'd read or update. Most common issue here would be missing some tables to update, leading to data inconsistence
Using Magento models performs slower, but you don't have to mind which database tables might be involved in your operation
-
Given Magento's EAV structure, it's really easy to corrupt the database if you don't do your homework when you create your direct SQL data inserts. Commented May 16, 2016 at 3:35