function apply(Elite_Vaf_Model_Vehicle $descendant)
 {
     $titles = $descendant->toTitleArray();
     $levelsToReplace = $this->getSchema()->getPrevLevelsIncluding($this->grain);
     foreach ($levelsToReplace as $levelToReplace) {
         $replacementTitle = $this->vehicle()->getLevel($levelToReplace)->getTitle();
         $titles[$levelToReplace] = $replacementTitle;
     }
     foreach ($this->newTitles as $replacementTitle) {
         $titles[$this->grain] = $replacementTitle;
         $new_vehicle = Elite_Vaf_Model_Vehicle::create($this->getSchema(), $titles);
         $new_vehicle->save();
         $this->mergeFitments($descendant, $new_vehicle);
     }
 }
Beispiel #2
0
<?php

session_start();
require_once 'F:\\dev\\vaf\\app\\code\\local\\Elite\\Vaf\\bootstrap-tests.php';
$schemaGenerator = new Elite_Vaf_Model_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array('make', 'model', 'year'));
$schema = new Elite_Vaf_Model_Schema();
$vehicle = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'year' => '2002'));
$vehicle->save();
$values = $vehicle->toValueArray();
?>
<!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"/>
    <link rel="stylesheet" href="/skin/adminhtml/default/default/multiTree.css" type="text/css"/>
    
    <script src="/skin/adminhtml/default/default/jquery-1.4.2.min.js"> </script>
    <script src="/skin/adminhtml/default/default/jquery.metadata.pack.js"> </script>
    <script type="text/javascript" src="../qunit/qunit.js"></script>
    <script type="text/javascript" src="/vaf/ajax/js"></script>
    <script type="text/javascript" src="../common.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function($){
            
            QUnit.done = function (failures, total) {
                top.testPageComplete( 'multiTreeTest/MMY.php', failures, total );
            };
Beispiel #3
0
<?php

require_once 'F:\\dev\\vaf\\app\\code\\local\\Elite\\Vaf\\bootstrap-tests.php';
$schemaGenerator = new Elite_Vaf_Model_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array('make', 'model', 'chassis', 'trim'));
$schema = new Elite_Vaf_Model_Schema();
$vehicle = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda_Unique' . uniqid(), 'model' => 'Civic', 'chassis' => 'chassis', 'trim' => 'trim'));
$vehicle->save();
$mapping = new Elite_Vaf_Model_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"/>
    <script src="/skin/adminhtml/default/default/jquery-1.4.2.min.js"> </script>
    <script src="/skin/adminhtml/default/default/jquery.metadata.pack.js"> </script>
    <script type="text/javascript" src="../common.js"></script>
    <script type="text/javascript" src="../qunit/qunit.js"></script>
    <script type="text/javascript" src="/vaf/ajax/js?front=1"></script>
    <script type="text/javascript">
        jQuery(document).ready(function($){
            
            QUnit.done = function (failures, total) {
                top.testPageComplete( 'ajaxTestJs/MMTC.php', failures, total );
            };
            
            module("Loading Levels");
            
<?php

require_once 'F:\\dev\\vaf\\app\\code\\local\\Elite\\Vaf\\bootstrap-tests.php';
$schemaGenerator = new Elite_Vaf_Model_Schema_Generator();
$schemaGenerator->dropExistingTables();
$schemaGenerator->execute(array('make', 'model', 'year'));
$schema = new Elite_Vaf_Model_Schema();
$vehicle1 = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Civic', 'year' => '2002'));
$vehicle1->save();
$vehicle2 = Elite_Vaf_Model_Vehicle::create($schema, array('make' => 'Honda', 'model' => 'Accord', 'year' => '2002'));
$vehicle2->save();
$mapping = new Elite_Vaf_Model_Mapping(1, $vehicle2);
$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"/>
    
    <script src="/skin/adminhtml/default/default/jquery-1.4.2.min.js"> </script>
    <script src="/skin/adminhtml/default/default/jquery.metadata.pack.js"> </script>
    <script type="text/javascript" src="../qunit/qunit.js"></script>
    <script type="text/javascript" src="/vaf/ajax/js?front=1"></script>
    <script type="text/javascript" src="../common.js"></script>
    <script type="text/javascript">
        jQuery(document).ready(function($){
            
            QUnit.done = function (failures, total) {
                top.testPageComplete( 'ajaxTestJs/MMYMultiple.php', failures, total );
            };
 function merge_vehicle($slave_vehicle, $master_vehicle)
 {
     $titles = $slave_vehicle->toTitleArray();
     $levelsToReplace = $this->getSchema()->getPrevLevelsIncluding($this->operatingGrain());
     foreach ($levelsToReplace as $levelToReplace) {
         $titles[$levelToReplace] = $master_vehicle->getLevel($levelToReplace)->getTitle();
     }
     $new_vehicle = Elite_Vaf_Model_Vehicle::create($this->getSchema(), $titles);
     $new_vehicle->save();
     $this->mergeFitments($slave_vehicle, $new_vehicle);
 }