function doSetUp()
 {
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     $schemaGenerator->execute(array('year' => array('global' => true), 'make' => array('global' => true), 'model'));
     $this->startTransaction();
 }
예제 #2
0
 static function create($levels)
 {
     $schema = new VF_Schema();
     $schema->getReadAdapter()->insert('elite_schema', array('key' => 'levels', 'value' => $levels));
     $schema->setId($schema->getReadAdapter()->lastInsertId());
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->execute(explode(',', $levels), false, $schema->id());
     return $schema;
 }
예제 #3
0
 function setUp()
 {
     VF_Singleton::reset();
     VF_Singleton::getInstance(true);
     VF_Singleton::getInstance()->setRequest(new Zend_Controller_Request_Http());
     $database = new VF_TestDbAdapter(array('dbname' => VAF_DB_NAME, 'username' => VAF_DB_USERNAME, 'password' => VAF_DB_PASSWORD));
     VF_Singleton::getInstance()->setReadAdapter($database);
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     $schemaGenerator->execute(array('make', 'model', 'year'));
     VF_Schema::reset();
 }
 function main()
 {
     $schema = new VF_Schema();
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     $schemaGenerator->execute(array('make', 'model', 'year'));
     for ($i = 2000; $i <= 2010; $i++) {
         $vehicleParts = array('make' => 'Honda', 'model' => 'Civic', 'year' => $i);
         $vehicle = VF_Vehicle::create($schema, $vehicleParts);
         $vehicle->save();
         echo "Created vehicle {$vehicle} \n";
     }
 }
예제 #5
0
 public function indexAction()
 {
     try {
         $schema = new \VF_Schema();
         $levels = $schema->getLevels();
     } catch (\Zend_Db_Statement_Exception $e) {
         $levels = array();
     }
     if ($this->getRequest()->isPost()) {
         $schemaGenerator = new \VF_Schema_Generator();
         $schemaGenerator->dropExistingTables();
         $schemaGenerator->execute(explode(",", $_POST['schema']));
         $this->flashMessenger()->setNamespace('success')->addMessage('Saved Schema');
     }
     return array('schema' => $levels);
 }
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Vehicle Fits to newer
 * versions in the future. If you wish to customize Vehicle Fits for your
 * needs please refer to http://www.vehiclefits.com for more information.

 * @copyright  Copyright (c) 2013 Vehicle Fits, llc
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
require_once '../config.default.php';
require_once(getenv('PHP_MAGE_PATH').'/app/code/local/Elite/Vaf/bootstrap-tests.php');

$schemaGenerator = new VF_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array('make','model type','year'));

$schema = new VF_Schema();

$vehicle = VF_Vehicle::create( $schema, array(
    'make' => 'Honda_Unique'.uniqid(),
    'model type' => 'Civic',
    'year' => '2002'
));
$vehicle->save();

$values = $vehicle->toValueArray();

$mapping = new VF_Mapping( 1, $vehicle );
$mapping->save();
예제 #7
0
 *
 * Do not edit or add to this file if you wish to upgrade Vehicle Fits to newer
 * versions in the future. If you wish to customize Vehicle Fits for your
 * needs please refer to http://www.vehiclefits.com for more information.
 * @copyright  Copyright (c) 2013 Vehicle Fits, llc
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
if (file_exists('../config.php')) {
    require_once '../config.php';
} else {
    require_once '../config.default.php';
}
require_once getenv('PHP_MAGE_PATH') . '/app/code/local/Elite/Vaf/bootstrap-tests.php';
$schemaGenerator = new VF_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array('make', 'model', 'chassis', 'trim'));
$schema = VF_Singleton::getInstance()->schema();
$vehicle = VF_Vehicle::create($schema, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'chassis' => 'chassis', 'trim' => 'trim'));
$vehicle->save();
$mapping = new VF_Mapping(1, $vehicle);
$mapping->save();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <link rel="stylesheet" href="../qunit/qunit.css" type="text/css"/>
  </head>
  <body>
    <h1 id="qunit-header">Vehicle Fits - MMTC</h1>
    <h2 id="qunit-banner"></h2>
예제 #8
0
 protected function switchSchema($levels, $force = false)
 {
     if (!$force) {
         try {
             $schema = new VF_Schema();
             if ($levels == implode(',', $schema->getLevels())) {
                 $this->startTransaction();
                 return;
             }
         } catch (Zend_Db_Statement_Mysqli_Exception $e) {
         } catch (Zend_Db_Statement_Exception $e) {
         }
     }
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     $schemaGenerator->execute(explode(',', $levels));
     VF_Schema::reset();
     $this->startTransaction();
 }
 *
 * Do not edit or add to this file if you wish to upgrade Vehicle Fits to newer
 * versions in the future. If you wish to customize Vehicle Fits for your
 * needs please refer to http://www.vehiclefits.com for more information.

 * @copyright  Copyright (c) 2013 Vehicle Fits, llc
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
require_once '../config.default.php';
require_once(getenv('PHP_MAGE_PATH').'/app/code/local/Elite/Vaf/bootstrap-tests.php');

$schemaGenerator = new VF_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array(
    'year',
    'make' => array('global'=>true),
    'model'
));

$schema = new VF_Schema();

$vehicle = VF_Vehicle::create( $schema, array(
    'make' => 'Honda',
    'model' => 'Civic',
    'year' => '2002'
));
$vehicle->save();
$mapping = new VF_Mapping( 1, $vehicle );
$mapping->save();

$vehicle2 = VF_Vehicle::create( $schema, array(