close
Phork Manual Table of Contents
Phork Framework User Guide 1.3.4

DatabaseFactory

Filepath: phork/php/database/DatabaseFactory.class.php

The DatabaseFactory loads the database configuration and instantiates and registers the correct type of database adaptor object based on the config. This is used in the bootstrap.


Example

if (AppConfig::get('DatabaseEnabled')) {
    AppLoader::includeClass('php/database/', 'DatabaseFactory');
    $objDatabaseFactory = new DatabaseFactory('database');
    AppRegistry::register('Database', $objDatabaseFactory->init());
}