/** Create a new cash for the given host and return it. * Returns null in case of error. */ public function add($cashRegisterId) { $pdo = PDOBuilder::getPDO(); $id = md5(time() . rand()); $stmt = $pdo->prepare("INSERT INTO CLOSEDCASH (MONEY, CASHREGISTER_ID, " . "HOSTSEQUENCE) VALUES (:id, :crId, :sequence)"); $sequence = CashesService::getLastSequence($cashRegisterId, $pdo) + 1; $stmt->bindParam(':id', $id); $stmt->bindParam(':crId', $cashRegisterId); $stmt->bindParam(':sequence', $sequence); if ($stmt->execute() !== false) { return $this->get($id); } else { return null; } }