Symfony1 如何在条令中设置默认类型、排序规则和字符集数据库?
如果我为Symfony 1.4使用条令1.2构建模式,我必须添加选项:type、collate和charset,例如:Symfony1 如何在条令中设置默认类型、排序规则和字符集数据库?,symfony1,doctrine,Symfony1,Doctrine,如果我为Symfony 1.4使用条令1.2构建模式,我必须添加选项:type、collate和charset,例如: AlSupplier: options: type: InnoDB collate: utf8_unicode_ci charset: utf8 columns: company_name: type: string(255) AlCountry: options: type: InnoDB collat
AlSupplier:
options:
type: InnoDB
collate: utf8_unicode_ci
charset: utf8
columns:
company_name:
type: string(255)
AlCountry:
options:
type: InnoDB
collate: utf8_unicode_ci
charset: utf8
columns:
country_name:
type: string(70)
AlSupplierCategory:
actAs:
NestedSet:
hasManyRoots: true
rootColumnName: root_id
Searchable:
fields: [category_keywords]
options:
type: InnoDB
collate: utf8_unicode_ci
charset: utf8
columns:
category_name:
type: string(200)
category_description:
type: text
category_keywords:
type: text
如何设置默认选项(类型、排序、字符集)?我不希望每次都这样写。只需在schema.yml文件的顶部声明它们,它们将应用于每个表:
options:
type: InnoDB
collate: utf8_unicode_ci
charset: utf8
来源:我同意汤姆的解决方案。
如果您希望InnoDB在全球范围内使用(例如也用于插件),可以在ProjectConfiguration.php
中定义它:
public function configureDoctrineConnection(Doctrine_Connection $connection)
{
$connection->setAttribute(Doctrine::ATTR_DEFAULT_TABLE_TYPE, 'InnoDB');
}
谢谢如果a在顶部声明此项,我将为AlSupplier:禁用校对,例如,我必须做什么?@Beyed Black。。。不确定,可能先试用最安全。我的猜测是,无论您在表级别声明什么,都会覆盖全局设置。这就是我所期望的工作方式。