ORM in PHP
Advantages:
- ORMs have their own APIs for building queries and so are less Vulnerable to SQL injection attacks.
- ORMs have tools that will inspect a schema and build up a set of model classes that allow you to interact with object in db.
- Instead of Directly interacting with db , you’ll be interacting with an abstraction layer that provides insulation between code and database Implementation.
- It provides mapping between logical business model and physical storage model.
- Cache management recently used data are cached in memeory so that it will reducing load on DBs.
- Concurrency support: support for multiple user updating same data simultaneously.
Disadvantages:
- If you have complex, hand tuned SQL
- If you have decided that your DB will have stored procedure as its interface.
- If you have a complex schema that can’t be replaced.
- If you have not dealing with object
- If you are using custom queries oftenly.
- Tight coupling: This approach creates tight dependency between model objects and database schemas. Changing in DB Schema has rippling affects in objects model and mapping configuration & vice-versa.
Filed under: Uncategorized