Skip to content

Instantly share code, notes, and snippets.

@backstageel
Created January 21, 2016 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save backstageel/6f4a25f521db35218940 to your computer and use it in GitHub Desktop.
Save backstageel/6f4a25f521db35218940 to your computer and use it in GitHub Desktop.
<?php
public function saveSomethig($data){
$datasource = $this->getDataSource();
$datasource->begin();
if(!$this-Model1->save($data)){
$datasource->rollback()
return false;
}
if(!$this-Model2->save($data)){
datasource->rollback();
return false;
}
$datasource->commit();
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment