示例#1
0
 /**
  * Only tested with PDO
  *
  * @param DBALException $error
  * @return bool
  */
 public function isDuplicateException(DBALException $error)
 {
     /** @var \PDOException $previous */
     $previous = $error->getPrevious();
     if (!$previous || $previous->getCode() != 23000) {
         return false;
     }
     return isset($previous->errorInfo[1]) && $previous->errorInfo[1] == 1062;
 }
示例#2
0
 /**
  * Only tested with PDO
  *
  * @param DBALException $error
  * @return bool
  */
 public function isDuplicateException(DBALException $error)
 {
     /** @var \PDOException $previous */
     $previous = $error->getPrevious();
     if (!$previous || $previous->getCode() != 23505) {
         return false;
     }
     return true;
 }