Reorganize classes to autoload by namespace
This commit is contained in:
parent
c65c7129a7
commit
dd672df81d
@ -618,8 +618,6 @@ abstract class Abstract_Query_Builder {
|
|||||||
$sql = $this->sql->explain($sql);
|
$sql = $this->sql->explain($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $sql . "<br />";
|
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,12 +51,6 @@ abstract class Abstract_Driver extends \PDO implements Driver_Interface {
|
|||||||
*/
|
*/
|
||||||
public $util;
|
public $util;
|
||||||
|
|
||||||
/**
|
|
||||||
* Reference to table_builder class
|
|
||||||
* @var \Query\Table\Table_Builder
|
|
||||||
*/
|
|
||||||
public $table;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last query executed
|
* Last query executed
|
||||||
* @var string
|
* @var string
|
23
autoload.php
23
autoload.php
@ -35,24 +35,23 @@ define('QDRIVER_PATH', QBASE_PATH.'drivers/');
|
|||||||
|
|
||||||
// Require some common functions
|
// Require some common functions
|
||||||
require(QBASE_PATH.'common.php');
|
require(QBASE_PATH.'common.php');
|
||||||
require(QBASE_PATH.'core/BadDBDriverException.php');
|
|
||||||
|
|
||||||
// Load Query Classes
|
// Load Query Classes
|
||||||
spl_autoload_register(function ($class)
|
spl_autoload_register(function ($class)
|
||||||
{
|
{
|
||||||
$class_segments = explode('\\', $class);
|
$class_segments = explode('\\', $class);
|
||||||
$class = strtolower(array_pop($class_segments));
|
$driver_class = strtolower(array_pop($class_segments));
|
||||||
|
|
||||||
// Load DB Driver classes
|
// Load DB Driver classes
|
||||||
$driver_path = QDRIVER_PATH . "{$class}";
|
$driver_path = QDRIVER_PATH . "{$driver_class}";
|
||||||
if ($class_segments == array('Query', 'Driver') && is_dir($driver_path))
|
if ($class_segments == array('Query', 'Driver') && is_dir($driver_path))
|
||||||
{
|
{
|
||||||
|
|
||||||
// Firebird is a special case, since it's not a PDO driver
|
// Firebird is a special case, since it's not a PDO driver
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
if (
|
if (
|
||||||
in_array($class, \PDO::getAvailableDrivers())
|
in_array($driver_class, \PDO::getAvailableDrivers())
|
||||||
|| function_exists('\\fbird_connect') && $class === 'firebird'
|
|| function_exists('\\fbird_connect') && $driver_class === 'firebird'
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
array_map('\\do_include', glob("{$driver_path}/*.php"));
|
array_map('\\do_include', glob("{$driver_path}/*.php"));
|
||||||
@ -61,19 +60,15 @@ spl_autoload_register(function ($class)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load other classes
|
// Load other classes
|
||||||
foreach(array(
|
$path = str_replace('\\', DIRECTORY_SEPARATOR, $class);
|
||||||
QBASE_PATH . "core/interfaces/{$class}.php",
|
$file = QBASE_PATH . "{$path}.php";
|
||||||
QBASE_PATH . "core/abstract/{$class}.php",
|
|
||||||
QBASE_PATH . "core/{$class}.php"
|
|
||||||
) as $path)
|
|
||||||
{
|
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
if (file_exists($path))
|
if (file_exists($file))
|
||||||
{
|
{
|
||||||
require_once($path);
|
require_once($file);
|
||||||
}
|
}
|
||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// End of autoload.php
|
// End of autoload.php
|
Loading…
Reference in New Issue
Block a user