Support the ongoing development of Laravel.io →
Eloquent Architecture
Last updated 1 year ago.
0

Illuminate is the namespace that the Laravel 4 components fall under.

Eloquent is an ORM and is a component of the Laravel framework therefore it falls under the Illuminate namespace.

Doctrine is not created or maintained by Taylor or the Laravel team and is another ORM / abstraction layer. At one point Laravel included parts of Doctorine for some parts of manipulating the database but I I don't know that it does anymore. It is still suggested in the composer.json file if you plan on renaming columns through migrations or other code.

Last updated 1 year ago.
0

So does Laravel use two ORMs?

If I do this:

$car = DB::table('cars')->find($id);

What is that using?

Last updated 1 year ago.
0

vbmark said:

So does Laravel use two ORMs?

If I do this:

$car = DB::table('cars')->find($id);

What is that using?

Here you are using Fluent and no ORM at all.

Last updated 1 year ago.
0

So there are three ways to access the database?

  • Doctrine
  • Eloquent
  • Fluent

I don't see how to use Doctrine yet, but doing benchmarks between Eloquent and Fluent I found using Fluent to be consistently five times faster than using Eloquent.

So I wont be using Eloquent.

Last updated 1 year ago.
0

You should read about the differences of these 2 tools! Fluent is "just" a QueryBuilder while Eloquent is a full ORM.

Last updated 1 year ago.
0

I did read about the differences and, though I am just learning about these technologies, it appears to me that I can do everything I need to with Fluent and its faster.

Last updated 1 year ago.
0

I don't see how Eloquent can be 5 times faster than Fluent. I think you might be doing something wrong if Eloquent is 5 times slower, it should probably be more like 1.1 times slower.

And be careful disregarding Eloquent --- after all, you can make the argument that you should just use vanilla php and not laravel/fluent/eloquent since optimized regular php specialized for your use case is always faster. And in terms of development/productivity, Eloquent is quite intuitive and certainly much easier, readable, and maintainable than writing a bunch of SQL joins, once you understand it.

For example, from the docs, with Fluent:

DB::table('users')
            ->join('contacts', 'users.id', '=', 'contacts.user_id')
            ->join('orders', 'users.id', '=', 'orders.user_id')
            ->select('users.id', 'contacts.phone', 'orders.price');

or with Eloquent:

User::with('contacts', 'orders')->get();

(pretty much)

Last updated 1 year ago.
0

andrewsuzuki,

I agree with everything you say and I may be refactoring back to Eloquent.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

neon5 neon5 Joined 21 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.