spadefoot / kohana-orm-leap

An ORM module for the Kohana PHP framework that is designed to work with all major databases.
http://spadefoot.github.io/kohana-orm-leap/
100 stars 25 forks source link

schema #23

Open matesko opened 12 years ago

matesko commented 12 years ago

very nice addition are schema classes. Are they going to be completed soon. They will enable model generation like Kohana ORM

spadefoot commented 12 years ago

If you don't mind posting the SQL dialect you are using, I will look at starting there first. MySQL? Oracle? MS SQL? etc...

matesko commented 12 years ago

i am using oracle and mysql. thanks for a great job

ghost commented 11 years ago

i extended leap to use a table prefix. this prefix is defined in database.php config file and this works well so far.

add this to Base_DB_Connection.php public static function get_fq_table($table, $config = 'default') {

    static $dsCache = array();

    if (isset($dsCache[$config])) {
        $dataSource = $dsCache[$config];
    }
    else {
        $dataSource = new DB_DataSource($config);
        $dsCache[$config] = $dataSource;
    }

    if (strlen($dataSource->prefix)) {
        return $dataSource->prefix . strtoupper($table);
    }

    return strtoupper($table);
}

in your models use public static function table() { return DB_Connection::get_fq_table('GROUPS'); }

that this works you have to extend the Base_DB_DataSource and add

this to init method: $this->settings['prefix'] = (isset($settings['prefix'])) ? (string) $settings['prefix'] : '';

and this to __get method case 'prefix':

then it should work.