Esempio n. 1
0
 function apply(VF_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 = VF_Vehicle::create($this->getSchema(), $titles);
         $new_vehicle->save();
         $this->mergeFitments($descendant, $new_vehicle);
     }
 }
Esempio n. 2
0
 function assertMMYTitlesEquals($make, $model, $year, VF_Vehicle $vehicle)
 {
     $expected = array('make' => $make, 'model' => $model, 'year' => $year);
     $this->assertEquals($expected, $vehicle->toTitleArray());
 }
Esempio n. 3
0
 function vehicleSlug(VF_Vehicle $vehicle)
 {
     $config = $this->getConfig();
     $rewriteLevels = $config->seo->rewriteLevels;
     if ($rewriteLevels) {
         $rewriteLevels = explode(',', $rewriteLevels);
         $slug = implode('~', $vehicle->toTitleArray($rewriteLevels));
     } else {
         $slug = implode('~', $vehicle->toTitleArray());
     }
     $slug = str_replace(' ', '-', $slug);
     $slug = str_replace('%7E', '~', urlencode($slug));
     // url encode everything but tildes
     return $slug;
 }