At the moment, I am setting my table charset and collation like this:
class Model extends Doctrine_Record
{
public function setTableDefinition()
{
//...
$this->option('collate', 'utf8_unicode_ci');
$this->option('charset', 'utf8');
}
}
I am setting this in all my table definitions. Is there a way to set a default value?
In my bootstrap I am setting other default values like this:
Doctrine_Manager::getInstance()->setAttribute(
Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS,
array('name' => 'id', 'type' => 'integer', 'length' => 4));
Would be nice, if there was a way to do the same for collate and charset.
I found constants for it, but couldn’t find where/if they were ever used somewhere.
Thanks
This is all you need (even with latin1 tables, accentued e for example will be saved correctly).
But to be honest, it is best to stick to the same charset throughout your system (DB, HTML) as you can loose some data (e.g. chinese characters inputed on your site won’t be saved in your latin1 tables)