- Copyright
- HomeCu 05/2019
A class specifically for adding sample data to loans. Not used directly; inject this object into your consumer class then call public addSampleData() with an array of prepared/mapped data.
$obj->addSampleData([array data]);
Expects
array[ [table identifier] = [ [ [field identifier] => [value], // for each field to insert ] ], // for each table to insert data ]
Returns array [ 'success' => [ [table name] => [int n count of successes], // for each table ], 'errors' => [ [table name] => array[ [string specific error], // for each error in this table ], // for each table ] ]
Definition at line 38 of file DbLoanCreator.php.
| DbLoanCreator::BuildInsertStatement |
( |
|
$table | ) |
|
|
protected |
Build the insert statements. Generally I would prefer to dynamically create fields and values but you have two choices in PHP for PostgreSql: fiddle about with data types and figure out which to escape and which not, or use pg_query_params which solves that and other issues (such as SQL injection.) The problem then becomes that the placeholders can't be dynamic, you need placeholders like $1, $2, etc. We only have a few tables in a test script so letting it slide. Just be sure the fields correspond . . .
- Parameters
-
- Returns
- string
Definition at line 253 of file DbLoanCreator.php.
258 return "insert into $table (email, pwd, allow_e_comm, cu, confidenceword, 259 failedloginattempts, challenge_quest_id, userlogintype, banking_user_id, 260 session_account) values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)";
262 case 'lnappschemadetail':
263 return "insert into $table (loanid, pageid, groupid, lineid, fieldtype, 264 fieldvalue, fieldattr) values($1, $2, $3, $4, $5, $6, $7)";
266 case 'lnappuserresponse':
267 return "insert into $table (userid, loanid, respstatus, respcomments, 268 respcoreloanappid, respstarton, respsubmiton, respmodifiedon, respfname, 269 resplname, respmname, respssn, respdob, respmember, respphone, respapplication, 270 respstatusdesc, respamt, resplastinquire) values($1, $2, $3, $4, $5, $6, $7, $8, 271 $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)";
273 case 'lnappschemamaster':
274 return "insert into $table (cu, loantitle, loandisclosure_fragment, lastmodified) values($1, $2, $3, $4)";
276 case 'lnappuser_questselect':
277 return "insert into $table(userid, questid, user_answer) values($1, $2, $3)";