I'm trying to extend Kohana_Database_PDO located in kohana\modules\database\classes\Kohana\Database
To do this I made a file in PDO.php file in kohana\application\classes\database
The code I am using is
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* PDO database connection.
*
* @package Application
* @category Drivers
*/
class Application_Database_PDO extends Kohana_Database_PDO {} // End Database_PDO
I get the error:
ErrorException [ Fatal Error ]: Class 'Database_PDO' not found MODPATH\database\classes\Kohana\Database.php [ 78 ]
// Set the driver class name
$driver = 'Database_'.ucfirst($config['type']);
// Create the database connection instance
$driver = new $driver($name, $config); <- highlighted line
// Store the database instance
Database::$instances[$name] = $driver;
}
Thanks for your help :)
If this code:
<?php defined('SYSPATH') OR die('No direct script access.');
/**
* PDO database connection.
*
* @package Application
* @category Drivers
*/
class Application_Database_PDO extends Kohana_Database_PDO {} // End Database_PDO
is the code in your PDO.php file which resides in APPPATH/classes/Database then it is no wonder that it doesn't work.
your file should look like this:
<?php defined('SYSPATH') or die('No direct script access.');
/**
* PDO database connection.
*
* @package Application
* @category Drivers
*/
class Database_PDO extends Kohana_Database_PDO {...
otherwise if you need it to be Application_... then you have to do your folderstructure like this: APPPATH/classes/Application/Database/PDO.php
Kohana by default explodes the Classname using the _
as the needle and uses every string part as a directory except for the last one which is the filename