/** * Closes and unlocks the bean * @return unknown_type */ public function __destruct() { //prepare database if (self::$engine === "innodb") { self::$db->exec("COMMIT"); } else { if (self::$engine === "myisam") { //nope } } RedBean_OODB::gc(); RedBean_OODB::releaseAllLocks(); //echo "destructor has been invoked"; }