-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Description
Hello! I just picked up ToroPHP and I normally use DI when I do any kind of database interaction.
Rough example
$db = new PDO("mysql:host=myhost;dbname=myname", "username", "password");
$object = new Object($db);
class Object {
private $db;
function __construct($dbConn) {
$this->db = $dbConn;
}
function get($string) {
$sql = $this->db->prepare("statement GOES here");
}
}But ToroPHP doesn't allow you to do this, is there any way to get around this? I don't wanna use a global variable.
Toro::serve(array(
"/" => "Object",
"/get/:string" => "Object" //would be injected somewhere so you could get :string from the db.
));Metadata
Metadata
Assignees
Labels
No labels