示例#1
0
 private function processUpdate()
 {
     $ids = $this->getRandomsNumbers(50, 50000, 1);
     $ids2 = $this->getRandomsNumbers(50);
     $queryesExecution = array();
     $peoples = array();
     foreach ($ids as $key => $id) {
         Debug::timer();
         // SELECT + UPDATE DATA
         $people = Models\People::find($id);
         $city = Models\City::findByName($this->peoplesData[$ids2[$key]]['city']);
         if ($city == NULL) {
             $city = Models\City::create($this->peoplesData[$ids2[$key]]['city']);
         }
         $people->setName($this->peoplesData[$ids2[$key]]['name'])->setStreet($this->peoplesData[$ids2[$key]]['street'])->setCity($city)->setMail($this->peoplesData[$ids2[$key]]['mail']);
         $peoples[] = $people->save();
         $queryesExecution[] = number_format(Debug::timer() * 1000, 2);
     }
     return array($queryesExecution, $peoples);
 }