compositephp / db

Fast and Lightweight PHP 8.1+ DataMapper and Table Gateway with automatic data caching, smart entities, migrations and many more
MIT License
79 stars 2 forks source link

Support for table joins #8

Open FluffyDiscord opened 1 month ago

FluffyDiscord commented 1 month ago

What about indexes, foreign keys and tables joins? Right now this package behaves like a key/value storage with SQL, rather than proper SQL database.

compositephp commented 2 weeks ago

Hi, thanks for the suggestion! In this project, there won’t be support for relations or joins, and here’s why:

Firstly, adding joins and relations would make automatic caching infeasible, which is one of the key features that sets this project apart from other ORMs. Secondly, I’m not a fan of traditional ORMs because they tend to introduce a lot of “magic” with relations and query builders, which can lead to performance issues. They often generate many uncontrolled joins, potentially resulting in very slow and unoptimized queries that can become a bottleneck. With this project, I aim for more direct control and fewer surprises, reducing the chances of running into these kinds of issues down the line.

Thanks again for your interest, and feel free to suggest other improvements or ask questions!