Example #1
0
function migrate()
{
    global $conn;
    $sql = getMigrateQueryHeader();
    $sql .= Customer::getSchemaSQL();
    $sql .= CustomerCar::getSchemaSQL();
    $sql .= EventLog::getSchemaSQL();
    $sql .= GreaseRatEvent::getSchemaSQL();
    $sql .= RepairPost::getSchemaSQL();
    $sql .= RepairType::getSchemaSQL();
    $sql .= User::getSchemaSQL();
    if ($conn->multi_query($sql)) {
        do {
            if ($result = $conn->store_result()) {
                while ($row = $result->fetch_row()) {
                    printf("%s\n", $row[0]);
                }
                $result->free();
            }
            if ($conn->more_results()) {
                printf("-----------------\n");
            }
        } while ($conn->next_result());
    }
    $conn->close();
}
Example #2
0
function PopulateEvent($event)
{
    return ["user_owner_id" => User::retrieveByPK($event->user_owner_id), "user_target_id" => User::retrieveByPK($event->user_target_id), "customer_id" => Customer::retrieveByPK($event->customer_id), "customer_car_id" => CustomerCar::retrieveByPK($event->customer_car_id)];
}
<?php

include_once dirname(__FILE__) . "/../models/index.php";
if (!$argv || count($argv) < 5) {
    print "Usage: add_customer_car.php [name] [mileage] [vin] [gv_number]";
    exit(1);
}
print "add_customer_car: {$argv[1]} {$argv[2]} {$argv[3]} {$argv[4]}";
$newCustomerCar = new CustomerCar();
$newCustomerCar->name = $argv[1];
$newCustomerCar->mileage = $argv[2];
$newCustomerCar->vin = $argv[3];
$newCustomerCar->gv_number = $argv[4];
$newCustomerCar->save();
exit(0);