protected static function getConnction() { if (!self::$conn) { try { // Ideally this would be in a noSql flat table. self::$conn = new PDO('mysql:host=localhost;dbname=mydatabase', 'root', ''); } catch (PDOException $e) { //Need to raise exception and let error controller handle it. echo json_encode(array("Error" => $e->getMessage())); die; } } return self::$conn; }