<?php 

    class Core {

        protected static $conn;
        protected $connDef;

        function __construct($conn) {

            $this->connDef = $conn;
            Core::$conn = $conn->getConnection();
            Core::$conn->beginTransaction();

        }

        function __destruct() {

            Core::$conn->commit();
            Core::$conn = null;

        }

        function getConnection() {            
            return Core::$conn;
        }

    }