DEV Community

Discussion on: Repository Pattern vs Atomic Query Construction (AQC) Design Pattern

Collapse
 
rzulty profile image
Piotr Grzegorzewski

There is beauty in the simplicity of AQC, but is achieved by putting everything into an undefined params array. Moreover, you then have this set of isset checks that build a query. Also, you assume that to retrieve a product you only need to query one table (in other words that business entity is the same as ORM entity).
From my point of view it looks great until it doesn't ;)
So as long as the params array is described in the DocBlock, and the class is split if a number of conditions becomes unclear, and you only need to query a limited set of tables, this is great.

Collapse
 
raheelshan profile image
Raheel Shan

Yes, the params array should definitely be documented — I agree with you on that. For now, since AQC is still in its initial form, I’ve kept it focused on querying a single table. Later on, we can evolve it further by adding methods for joins and handling related data.