Tagged with SQL

Improved CASE expression in CakePHP 4.3

CakePHP 4.3 was recently released, and it contains a greatly improved way to build CASE expressions. CASE expressions are great when you want to do conditional aggregation or add computed fields to results. Lets say you wanted to create SQL that mapped integer values to string names, you could use SQL that looks like:

Testing SQLServer and PHP locally in 2021

I’ve recently been working on overhauling the test database fixture system in CakePHP . My goals are to separate fixture schema management from fixture data management. By doing this applications will more easily be able to use their existing schema management to generate their test database. This project has entailed fixing many differences between the database servers that CakePHP supports.

Creating easy reports with pivot tables

I’ve been working on a project that collects various surveys and stores the data very much like below.

table schema

While this is a data structure is very normalized and provides a flexible base to build various surveys with. What it does not provide is an easy interface for building reports.