Skip to content

Instantly share code, notes, and snippets.

@joshtronic
Created October 3, 2010 15:39
Show Gist options
  • Save joshtronic/608676 to your computer and use it in GitHub Desktop.
Save joshtronic/608676 to your computer and use it in GitHub Desktop.
PICKLES Model Example
<?php
// Pulls the records with ID 1-10
$city = new City(array('conditions' => array('id BETWEEN' => array(1, 10))));
// Loops through the records
while ($city->record)
{
// Sets the active field to 0 for the current record
$city->record['active'] = 0;
// Commits the current record (UPDATE)
$city->commit();
// Moves to the next record
$city->next();
}
// @todo Implement $city->commitAll() to avoid doing ->commit() in the loop
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment