dibi::begin PHP Method

begin() public static method

Begins a transaction - Monostate for Dibi\Connection::begin().
public static begin ( $savepoint = NULL ) : void
return void
    public static function begin($savepoint = NULL)
    {
        self::getConnection()->begin($savepoint);
    }

Usage Example

Exemplo n.º 1
0
 public function onSubmit(Form $form)
 {
     $data = $form->getValues();
     // Předáme data do šablony
     $this->template->values = $data;
     $queueId = uniqid();
     \dibi::begin();
     $gallery_id = $this->gallery->insert(array("name" => $data["name"]));
     // Přesumene uploadované soubory
     foreach ($data["upload"] as $file) {
         // $file je instance HttpUploadedFile
         $newFilePath = FILESTORAGE_DIR . "/q{" . $queueId . "}__f{" . rand(10, 99) . "}__" . $file->getName();
         // V produkčním módu nepřesunujeme soubory...
         if (!Environment::isProduction()) {
             if ($file->move($newFilePath)) {
                 $this->flashMessage("Soubor " . $file->getName() . " byl úspěšně přesunut!");
             } else {
                 $this->flashMessage("Při přesouvání souboru " . $file->getName() . " nastala chyba! Pro více informací se podívejte do logů.");
             }
         }
         $this->files->insert($file);
         $this->gallery->addFile($gallery_id, $file_id);
         dump($file);
     }
     \dibi::commit();
 }
All Usage Examples Of dibi::begin