print Using baseTableParamSet in DAOs

Introduction

A common problem when dealing with relational databases is how to store additional data that might not be used for every record in a main table. For example: you might have a products table with the common main elements, but how do you store those specific bits of information that only relate to digital content, or dimensions, or available finishes or external specifications etc.

One solution (of many!) is to use a properties or parameters table. This is very basically a key:value table of properties (or parameters if you prefer) that allows for arbitrary information to be stored for a particular master record.

Scorpio comes bundled with a pre-rolled class called: baseTableParamSet that can work directly with these types of tables without requiring repetitive coding.

This tutorial will look at how to setup a database table for use with this object, the available options and possible issues you might encounter and then how it can be integrated into a main object that has been generated by the Scorpio class generator component.

Requirements

For this tutorial you will need a copy of the Scorpio framework that has been configured and is ready to run. See the "Creating a Dev Environment" tutorial if this is your first project with Scorpio.

In addition you will need a database that has been configured for use with Scorpio. This tutorial uses MySQL. The database wll need at least one table. If you are struggling for an example, this tutorial will use the following table schema in a database called "crm":

crm.users

Finally you will need an editor or IDE. An IDE is preferred for the auto-complete support. A few suggestions are Netbeans, Zend Studio, Eclipse with PDT and PhpStorm.