atk4 / data

Data Access PHP Framework for SQL & high-latency databases
https://atk4-data.readthedocs.io
MIT License
273 stars 46 forks source link

Remove WITH/CTE column mapping for model #1021

Closed mvorisek closed 2 years ago

mvorisek commented 2 years ago

Mapping duplicated the functionality of Field::$actual, so we drop the WITH mapping from model completely.

Mapping was also used for filtering wanted columns, we drop it as it mutated the source model state and DB query optimizer should be smart enough to prune the unneded columns. Later, we should optimize them away automatically. Alternatively, you can set Model::$onlyFields for the added CTE model manually.

Also, the method was renamed from Model::addWith to Model::addCteModel and name/alias is now accepted as the 1st param.