Welcome Guest, Not a member yet? Register   Sign In
Poll: Do you think this would be helpful?
You do not have permission to vote in this poll.
Yes
50.00%
3 50.00%
No
33.33%
2 33.33%
I don't use Soft Deletes
16.67%
1 16.67%
Total 6 vote(s) 100%
* You voted for this item. [Show Results]

Query Builder Soft Deletes
#3

This isn't the first time this has come up. I understand the interest, but this is really bleeding together very different aspects of two components. Query Builder is our database abstraction layer: it lets use write object-oriented methods and have them interact with the database. Most importantly, it is completely structure agnostic - it knows nothing about what is in the database it interacts with. Models (ideally) are the inverse: they provide a concept of data structure without having to know how to interact with the database itself. In practice the Model does some SQL-fu, but that's out of necessity.
Convenience aside, it is a really bad idea (in my opinion) to make Query Builder aware/reliant on any particular data structure in the database. In order to "support soft deletes" Query Builder not only needs to know which tables are "entities", but it also needs to know which fields indicate deletion (like deleted_at) and what type of field that is (nullable, some time representation). At this point what you're doing is taking what makes Model a valuable class and muddying it into Builder.
Reply


Messages In This Thread
Query Builder Soft Deletes - by PwrSrg - 05-26-2021, 07:46 AM
RE: Query Builder Soft Deletes - by seunex - 05-26-2021, 10:21 AM
RE: Query Builder Soft Deletes - by MGatner - 05-28-2021, 06:39 PM
RE: Query Builder Soft Deletes - by includebeer - 05-29-2021, 08:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB