Access

Refer to the figure on the right (an example invoice document).

In Boxary the access to data is described in a Given, When, Then model. The syntax is relaxed using user-defined names pointing to a SQL table or qualified column names (name.column). Syntax of a query is

$given = [ 'myName' => 'nodeName', ........ ]
$when  = [ 'myName' => 'condition', ...... ]
$then  = [ 'propertyName', ..... ] 

where nodeName and propertyName are mapped onto resp. tables and columns.

Example query:

Given (manifest):

  • orders => Orders,
  • customers => Customers,
  • lines => OrderLines,
  • cc => CreditCards;

When (conditions):

  • customers => 'orders.customerID == customers.customerID',
  • lines => 'orders.orderID == lines.orderID',
  • cc => 'customers.customerID == cc.customerID';

Then (retrieval):

  • orders.orderID,
  • customers.custID,
  • lines.linesID, lines.quantity, lines.price,
  • cc.*

Given limits the scenery, When follows the path; Then opens the door and retrieves.