Pimcore\Db::reset PHP Метод

reset() публичный статический Метод

public static reset ( ) : Zend_Db_Adapter_Abstract
Результат Zend_Db_Adapter_Abstract
    public static function reset()
    {
        // close old connections
        self::close();
        return self::get();
    }

Usage Example

Пример #1
0
 /**
  * @param $file
  * @throws \Zend_Db_Adapter_Exception
  */
 public function insertDump($file)
 {
     $sql = file_get_contents($file);
     //replace document root placeholder with current document root
     $docRoot = str_replace("\\", "/", PIMCORE_DOCUMENT_ROOT);
     // Windows fix
     $sql = str_replace("~~DOCUMENTROOT~~", $docRoot, $sql);
     // we have to use the raw connection here otherwise \Zend_Db uses prepared statements, which causes problems with inserts (: placeholders)
     // and mysqli causes troubles because it doesn't support multiple queries
     if ($this->db->getResource() instanceof \Zend_Db_Adapter_Mysqli) {
         $mysqli = $this->db->getConnection();
         $mysqli->multi_query($sql);
         // loop through results, because ->multi_query() is asynchronous
         do {
             if ($result = $mysqli->store_result()) {
                 $mysqli->free_result();
             }
         } while ($mysqli->next_result());
     } elseif ($this->db->getResource() instanceof \Zend_Db_Adapter_Pdo_Mysql) {
         $this->db->getConnection()->exec($sql);
     }
     \Pimcore\Db::reset();
     // set the id of the system user to 0
     $this->db->update("users", ["id" => 0], $this->db->quoteInto("name = ?", "system"));
 }
All Usage Examples Of Pimcore\Db::reset