SproutCMS

This is the code documentation for the SproutCMS project

function replaceSet()

Inserts records which are in $new_records, but are not in the specified table
Deletes records which are in the specified table, but not in $new_records
Updates records which are in both

Matching is done on the 'id' field, as a result the $new_records arrays MUST contain an id field.

Usage

void $Controller->replaceSet ( string $table , array $new_records , array $conditions );

Arguments

  1. string $table
    The table name. Do not include prefix.
  2. array $new_records
    The new records for the table. Should be an array of arrays,
           With each sub-array being the arguments which would normally be passed to Pdb::insert or Pdb::update
  3. array $conditions
    A where clause to use when looking to see what records already exist. Pdb::buildClause

Exceptions thrown

  • QueryException

Return value

  • void