Php – an ORM in a web application


I recently got a reply from a server company asking if we are using an ORM in our application which does all the work of sifting application side (like Rails) or if we write reams of SQL, embedded functions etc which would make the database server do the processing for you.

Can anyone explain what is meant by this. Our web application is made up of PHP scripts with functions that make calls to the database to retrieve rows of data, then PHP processes these rows as needed to return results to the user.


Best Solution

It basically makes your database tables appear like objects on the PHP side of your site so you can easily manipulate data.

For example if you have a User table, getting this user's name is as easy as doing: $myUser->getName();

adding a new user in your database would be:

$myUser = new User();
$myUser->setName('John Doe');

Of course this is pseudo code (actually PHP Symfony/Doctrine code), but it's a simple example so you get the point.