Answer the question
In order to leave comments, you need to log in
Do I need another ORM - Query-Builder?
New Year holidays. It's time to write something useful. But there are many ideas, and not all can be good. Therefore, I want to consult with you.
For some reason, many popular ORMs have a syntax that is essentially sql queries, only in php expressions, such as:
$females = ORM::for_table('person')->where('gender', 'female')->find_many();
foreach ($db->users->age->gt(30) as $user) {
echo $user->title;
}
$db->users->age(28)->isEmpty();
$db->users
->extend($db->roles->id->title->userId($db->users->id))
->find();
$db->users
->id->toInt()
->title->toString()
->find();
$db->users
->new()->title('John')
->new()->title('Jack')
->new()->title('Smith')
->save();
$db->users
->name('john')
->if($age)->age($age)
->find();
$db->users->fullName(‘Jack Jones’);
$db->users($id)->title
Answer the question
In order to leave comments, you need to log in
Do you need another ORM with this syntax?
If you need it, do it and don't ask anyone.
I like your version less than Doctrine2's QueryBuilder implementation. And there is also DQL, which is also sometimes convenient. Yes, and I'm personally satisfied with it.
In fact yes. If it’s convenient for you, do it without asking, and there will always be like-minded people, the idea is good. I really like this approach too. Will wait :-)
I don't like the current approach in php orm. and I really like how in django.
I'm trying to do something similar https://github.com/buldezir/dja_orm
check it out, if it's not difficult, feedback is better on skype ( buldezir )
I am using Eloquent (Laravel). Very simple, concise, convenient. I also worked with doctrine2, but Eloquent is enough for most of my tasks.
but I didn't like it, it reminds me of the for_table kohana style.
Then it's better to just table
In
laravel Eloquent'a quite a convenient ORM
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question