What is Object-relational mapping (ORM) give ans in simple language with example?
Try to understand what is Object-relational mapping (ORM)
What is Object-relational mapping (ORM) give ans in simple language with example?
Try to understand what is Object-relational mapping (ORM)
ORM- Object Relational Mapping is a tool which allows database row to refer as object in PHP programming. What Wikipedia says about ORM is:
Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a “virtual object database” that can be used from within the programming language.
(Object-Relational Mapping) is a tool that allows you query database table and manipulate data from a database using an object paradigm (Object Oriented).
Briefly, ORM give you possibilities about write short, clean, relational by many SQL/NoSQL languages in one type of code:
Example by Laravel and pure SQL.
Without ORM:
Select * from cities where exists (Select * from countries where cities.country_id = countries.id and id > 10)
With ORM (after relation):
$cities = Cities::with('countries')->get();