EDDYMENS

Published a year ago

What Is An Object Relational Model Orm?

Table of contents

Definition

Object Relational Models (ORMs) is a library [→] which is code that helps developers to represent and work with data from databases [→] in the form of objects without context switching between their programming language [→] and say SQL.

Use cases and Examples

As an example, if a developer working in PHP wanted to retrieve some data from the database without using an ORM, the code would look like this:

01: SELECT * FROM students;

In an ORM like Eloquent, it would look like this:

01: Students::all();

In the second code example, it appears to be shorter, but that's not always the case nor is it the main benefit. An advantage of this is that a developer who does not know SQL can still understand what is happening in their PHP code.

Additionally, if the team decides to switch databases, little needs to be changed within their code.

Summary

There are many ORMs that are part of a web framework [→] such as Eloquent, which is a part of the 'Laravel framework' [↗].

Here is another article you might like 😊 What Is An Operating System?