Field Formula
Apply formula for fields before insert/update operation (added in version 2.5)
You can apply basic formula to change value of the field before insert/update operation dynamically. It can be done using
the callback function also but this function is added to provide more convenient way to do same. It also helps to set
the value to NULL for empty values to help to enter data in case of database restriction for e.g. saving NULL for datetime
for empty values.
$pdocrud = new PDOCrud();
// format field to 2 decimal point
$pdocrud->fieldFormula("tax", "formula",array("type" =>"round","decimalpoint"=>2));
// format field to 2 decimal point
$pdocrud->fieldFormula("product_discount", "formula",array("type" =>"number_format","decimalpoint"=>2));
// get ceil value of field
$pdocrud->fieldFormula("product_price", "formula",array("type" =>"ceil"));
//get floor value of field
$pdocrud->fieldFormula("product_sell_price", "formula",array("type" =>"floor"));
//string type - adding prefix of sku always and checking for duplicate i.e. string already have sku or not
$pdocrud->fieldFormula("product_id","string",array("type" =>"prefix","str"=>"SKU_","duplicate"=>true));
//make product name first letter upper case
$pdocrud->fieldFormula("product_name", "string",array("type" =>"uppercase"));
//setting value to NULL if empty
$pdocrud->fieldFormula("added_Date", "string",array("type" =>"null"));
echo $pdocrud->dbTable("products")->render();
1:12 scale model of a 1968 Dodge Charger. Hood, doors and trunk all open to reveal highly detailed interior features. Steering wheel actually turns the front wheels. Color black
Very detailed 1970 Plymouth Cuda model in 1:12 scale. The Cuda is generally accepted as one of the fastest original muscle cars from the 1970s. This model is a reproduction of one of the orginal 652 cars built in 1970. Red color.
This model features soft rubber tires, working steering, rubber mud guards, authentic Ford logos, detailed undercarriage, opening doors and hood, removable split rear gate, full size spare mounted in bed, detailed interior with opening glove box