* (c) 2008 Guglielmo Celata <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * Creates the initial wiki descriptions for Attos and Votaziones
 */
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/..'));
define('SF_APP', 'fe');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG', true);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
sfContext::getInstance();
// clean all pages and content
nahoWikiPagePeer::doDeleteAll();
nahoWikiContentPeer::doDeleteAll();
// define all classes that needs descriptions and their prefix in the name field
$classes = array('OppAtto' => 'atto', 'OppVotazione' => 'votazione');
$tot_cnt = 0;
foreach ($classes as $model => $name_prefix) {
    echo "Processing {$model} ";
    $c = new Criteria();
    // extract the number of items to process for the generator
    $n_todo = call_user_func_array(array($model . 'Peer', 'doCount'), array($c));
    echo "({$n_todo}) ";
    // get table map and columns map for this generator
    $model_table = call_user_func($model . 'Peer::getTableMap');
    $model_columns = $model_table->getColumns();
    // find and store primary keys
    $pks = array();
    foreach ($model_columns as $column) {