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.
So does Laravel use two ORMs?
If I do this:
$car = DB::table('cars')->find($id);
What is that using?
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.
So there are three ways to access the database?
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.
You should read about the differences of these 2 tools! Fluent is "just" a QueryBuilder while Eloquent is a full ORM.
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.
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)
andrewsuzuki,
I agree with everything you say and I may be refactoring back to Eloquent.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community