我的i18n条令模式和I.A.管理生成器有一个奇怪的问题。
(请先看下面的编辑部分)
架构如下:
CargoSize:
connection: doctrine
actAs:
Timestampable: ~
I18n:
fields: [name, linkname, seoname, description]
tableName: com_cargo_size
columns:
id: { type: integer(11), notnull: true, unsigned: true, primary: true, autoincrement: true }
name: { type: string(50), notnull: true }
linkname: { type: string(100), notnull: true }
seoname: { type: string(100), notnull: true }
description: { type: string(255), notnull: true }
我对sfforms的第一个问题是:
new sfWidgetFormDoctrineChoice(array('model' => 'CargoSize', 'expanded' => true, 'multiple' => false), array('style' => 'list-style-type: none; display: inline;'))
这将生成一个具有正确ID但名称值为空的无线Butten集。
即使我试图通过id和lang直接选择cargosize对象来获取name值,get name()也总是返回一个空字符串(数据库中正确地填充了适当的数据)。
那么,是不是有人在研究模式定义??
第二个问题出现在管理生成器中:
php symfony doc:generate-admin --module=cargo_size admin CargoSize
generator.yml如下所示:
generator:
class: sfDoctrineGenerator
param:
model_class: CargoSize
theme: admin
non_verbose_templates: true
with_show: false
singular: ~
plural: ~
route_prefix: cargo_size
with_doctrine_route: true
actions_base_class: sfActions
config:
actions: ~
fields: ~
list:
display: [name, lang]
filter: ~
form: ~
edit:
display: [name]
new: ~
有趣的是,列表视图显示了i18n的名称。但在编辑视图中,我总是得到错误
“小部件'名称'不存在”
.
你们知道为什么会这样吗?我非常感谢你的帮助。
编辑:
我认为问题更深层,因为这种简单的代码和平确实起到了作用:
首先是示例的数据集:
cargo_size
id created_at updated_at
1 2010-04-22 21:37:44 2010-04-22 21:37:44
cargo_size_translation
id name linkname seoname description lang
1 klein klein klein klein de
1 small small small small en
$c = Doctrine::getTable('CargoSize')->findOneBy('id', 1);
echo $c; // (toString exists)
// Output: Catchable fatal error: Method CargoSize::__toString()
// must return a string value in
// /var/www/.../apps/frontend/modules/start/templates/indexSuccess.php on line 1
echo $c->getName();
// Output: nothing
有人知道吗?我真的被开除了:(