1.4. Configure the System

  1. Open the SYSTEM/config.php file. You will add elements to the $config array inside this file before the return statement at the end of the file.

  2. Find the entry for the front controller and tell it what your application class prefixes will be via the 'classes' key.

    <?php
    // front controller
    $config['Solar_Controller_Front'] = array(
        'classes' => array('Acme_App', 'Solar_App'),
        // ...
        'explain' => true,
    );

    [Note] Note

    Having Solar_App as part of the class stack allows Solar to look in both Acme and Solar for the first matching app name.

  3. Find the entry for the model catalog and tell it what your application class prefixes will be.

    <?php
    // model catalog
    $config['Solar_Sql_Model_Catalog']['classes'] = array('Acme_Model');

  4. Add new $config keys to tell Solar what SQL adapter to use, and to configure that adapter.

    For SQLite, use the following.

    <?php
    // the SQL adapter class to use
    $config['Solar_Sql']['adapter'] = 'Solar_Sql_Adapter_Sqlite';
    
    // configure the SQL adapter class
    $config['Solar_Sql_Adapter_Sqlite'] = array(
        'name' => "$system/sqlite/acme.sq3",  // the database file to use
    );

    [Note] Note

    The $system variable is defined at the top of the SYSTEM/config.php file and is the same as the SYSTEM directory.

    For MySQL, use the following.

    <?php
    // the SQL adapter class to use
    $config['Solar_Sql']['adapter'] = 'Solar_Sql_Adapter_Mysql';
    
    // configure the SQL adapter class
    $config['Solar_Sql_Adapter_Mysql'] = array(
        'host' => 'localhost', // the database server host
        'name' => 'database',  // the database name
        'user' => 'username',  // authenticate as this user
        'pass' => 'password',  // authenticate with this password
    );

    [Note] Note

    For PostgreSQL, substitute Solar_Sql_Adapter_Pgsql for the adapter class name and the config key.

By the end of this process, the end of your config file should look something like this:

<?php
/**
 * project overrides
 */

// front controller
$config['Solar_Controller_Front'] = array(
    'classes' => array('Acme_App', 'Solar_App'),
    'disable' => array(),
    'default' => 'hello',
    'rewrite' => array(),
    'routing' => array(),
    'explain' => true,
);

// model catalog
$config['Solar_Sql_Model_Catalog']['classes'] = array('Acme_Model');

// the SQL adapter class to use
$config['Solar_Sql']['adapter'] = 'Solar_Sql_Adapter_Sqlite';

// configure the SQL adapter class
$config['Solar_Sql_Adapter_Sqlite'] = array(
    'name' => "$system/sqlite/acme.sq3",  // the database file to use
);

/**
 * done!
 */
return $config;



Local