<?php
class dbLayer
{
//connection from here
private $done;
function __construct(PDO $connection)
{
$this->done = $connection;
}
public function createAction()
{
//create a new item
}
public function readAction()
{
//read all the items
}
public function updateAction()
{
$sql = $this->done->prepare("UPDATE `sync_log` SET `Sync_Status`=? WHERE `randKey`=?");
$sql->execute(array(
$status,
$randKey
));
}
public function deleteAction()
{
//delete a item
}
}
?>
I want to use $pdo->beginTransaction();
with class methods.How i use roalback() if my update fail with updateAction()
method ?