<?php require '../../boot.php'; list($cmd, $supporter_KEY) = $argv; $result = $DIA->get('supporter', $supporter_KEY); $s = new Supporter($result); $s->db_upsert(); $model_array = array('SupporterAction', 'Email', 'Donation', 'ContactHistory', 'SupporterEvent', 'SupporterCompany', 'SupporterShare'); foreach ($model_array as $model) { $table = $model::$table_name; $results = $DIA->get($table, array('condition' => array('supporter_KEY=' . $supporter_KEY))); foreach ($results as $result) { $instance = new $model($result); $instance->db_upsert(); } } $db->query('DELETE FROM `tag_data` WHERE database_table_KEY=142 AND `table_key`=' . $supporter_KEY); $results = $DIA->get('tag_data', array('condition' => array('database_table_KEY=142', 'table_key=' . $supporter_KEY))); foreach ($results as $result) { print_r($result); $instance = new TagData($result); $instance->db_insert(); } $db->query('DELETE FROM `supporter_groups` WHERE `supporter_KEY`=' . $supporter_KEY); $results = $DIA->get('supporter_groups', array('condition' => array('supporter_KEY=' . $supporter_KEY))); foreach ($results as $result) { $instance = new SupporterGroups($result); $instance->db_insert(); }