Regarding my configuration prefix; how to use it?
I would like to set up a table prefix for all my models, since this is how it is designed in the database.
- How can I achieve that?
- How can set it in config.php
- How can I use in Model
class Users extends Phalcon\Mvc\Model
{
public function getSource()
{
//return 'ik_' . 'users';
return $this->get('config')->database->prefix.'users';
}
}
//config.php 'prefix' => 'ik_'
//////////////////////////////////////////////////////
return new \Phalcon\Config(
'database' => array(
'adapter' => 'mysql',
'host' => 'localhost',
'username' => 'root',
'password' => '',
'name' => 'ikphp',
'prefix' => 'ik_', // table prefix
),
));