rendered paste bodyclass Intraface_TableGateway extends pdoext_TableGateway
{
private $user;
function __construct($table, $conn, $user)
{
$this->user = $user;
parent::__construct($table, $conn);
}
function insert($data)
{
$data['intranet_id'] = $this->user->getActiveIntranetId();
$data['user_id'] = $this->user->getId();
parent::insert($data);
}
function update($data, $condition)
{
$condition['intranet_id'] = $this->user->getActiveIntranetId();
$condition['user_id'] = $this->user->getId();
parent::update($data, $condition);
}
function delete($condition)
{
$condition['intranet_id'] = $this->user->getActiveIntranetId();
$condition['user_id'] = $this->user->getId();
parent::delete($condition);
}
}
class Ticket_TableGateway extends Intraface_TableGateway
{
function __construct($conn, $user)
{
parent::__construct('ticket', $conn, $user);
}
function getFromId($id)
{
$result = parent::fecth($id);
return new Ticket($result);
}
}
class Ticket {
function __construct($result)
{
// loop through the result and set Ticket variables
}
}