4 ms·
This seems very close to what PHP does. The difference is that PHP doesn't have so many ways to express itself so it's all done with method-chaining. In my opi
by daGrevis 13y ago
This seems very close to what PHP does. The difference is that PHP doesn't have so many ways to express itself so it's all done with method-chaining.
In my opinion, this is the way to write the core of an ORM and it should allow to use this abstraction layer too! It's somewhat between SQL queries as strings and ORM-level, I think.
- kijin 13y agoPHP doesn't have a built-in ORM. Which framework/library are you talking about?
- daGrevis 13y agoNot anything super specific. Kohana, for example, has ORM that uses that-alike way to built queries. And, as far as I know, it's ORM is built on top of that. I think that ORMs should have something like that in them instead of SQL queries as strings.
- est 13y agoI think the selling point of Pony ORM is that you can write variable and literals instead of string. Django: Item.objects.filter(price__gt=3) Pony ORM: select(o for o in Item if o.price>3) Peewee: Item.select().where(Item.price>3) Kohana: $Item->where('price', '>', 3)->find(); You see, the __gt or '>' here is kind of stupid.