コード例 #1
0
 public function insert(Url $url)
 {
     try {
         $this->getMongoCollection()->insert(['_id' => $url->getId(), 'processing' => false, 'url' => $url->toArray()]);
     } catch (\MongoCursorException $e) {
         if ($e->getCode() === 11000) {
             return false;
         }
         throw $e;
     }
     $this->createIndexes();
     return true;
 }