function testShouldSaveLevel()
 {
     $schema = VF_Schema::create('foo,bar');
     $vehicle = VF_Vehicle::create($schema, array('foo' => 'valfoo', 'bar' => 'valbar'));
     $vehicle->save();
     $levelFinder = new VF_Level_Finder($schema);
     $foundLevel = $levelFinder->find('foo', $vehicle->getValue('foo'));
     $this->assertEquals($vehicle->getValue('foo'), $foundLevel->getId(), 'should save & find level');
 }
Ejemplo n.º 2
0
 function getLevel($level)
 {
     if ($this->hasLoadedLevel($level)) {
         return $this->levels[$level];
     }
     if ($this->levelIsOutsideFlexibleSelection($level)) {
         return new VF_Level($level, 0, $this->schema());
     }
     $id = $this->getValue($level);
     $levelFinder = new VF_Level_Finder($this->schema());
     $object = $levelFinder->find($level, $id);
     if (false == $object) {
         $object = new VF_Level($level, $id, $this->schema());
         if (false == $id) {
             $title = isset($this->titles[$level]) ? $this->titles[$level] : '';
             $object->setTitle($title);
         }
     }
     $this->levels[$level] = $object;
     return $object;
 }