refactoring for dependency injection and testability.

This commit is contained in:
Taylor Otwell
2011-08-25 22:53:05 -05:00
parent 0b86c94551
commit 1e7850d9ba
75 changed files with 1441 additions and 1461 deletions

View File

@@ -0,0 +1,28 @@
<?php namespace Laravel\Database\Query;
use Laravel\Database\Query;
use Laravel\Database\Connection;
class Factory {
/**
* Create a new query instance based on the connection driver.
*
* @param string $table
* @param Connection $connection
* @param Compiler $compiler
* @return Query
*/
public static function make($table, Connection $connection, Compiler $compiler)
{
switch ($connection->driver())
{
case 'pgsql':
return new Postgres($table, $connection, $compiler);
default:
return new Query($table, $connection, $compiler);
}
}
}