Exemple #1
0
 /**
  * Grab the original state of the table
  * @param string $table The table to select
  * @param string $condition The WHERE clause
  * @param array $keys Keys to select. Defaults to all
  * @return array
  */
 public function fetchOriginal($table, $condition, array $keys = array('*'))
 {
     if (!in_array('*', $keys, true)) {
         // Include the primary key in the rows for original state
         $primaryKey = $this->getPrimaryKey($table);
         if (!in_array($primaryKey, $keys, true) && !in_array('*', $keys, true)) {
             $keys[] = $primaryKey;
         }
     }
     $sql = "SELECT " . implode(',', $keys) . "\n                  FROM " . DBO::cleanFieldName($table) . "\n                 WHERE {$condition};";
     return $this->db->query($sql)->fetchAll();
 }