Monday 3 July 2017

What is ORM Framework?


ORM is for Object Relational Mapping, an ORM framework is written in an object oriented language (like PHP, Java, C# etc…) and it is designed to virtually wrap around a relational database.
Basically, the ORM framework/software generates objects  that virtually map  the tables in a database. Then you as a programmer, would use these objects to interact with the database. So the main idea, is the programmer should write optimized SQL code.

let's suppose you need to add new client in database, you would just have to use the ORM’s clients object to add the new client.
For example:

client = new clients_object("Stefan","Mischook");
client.save();

The above of course, is just pseudo code, because the syntax will vary from ORM framework and from language to language.

When to use an ORM framework?

I would start considering the use of ORM when:

  • You have 3 or more programmers on a web application. 
  • Your database consist of 10+ tables. 
  • You have say 10+ queries to make.



ORM Frameworks for PHP programmers

Here are a few ORM frameworks to consider:

  • Doctrine
  • Part of the cool Zend Framework Zend Db
  • CakePHP has ORM built into it.
  • RedBean ORM without configuration!