我有一個奇怪的問題,我的i18n教義架構和i.a.管理生成器。Symfony 1.4:Doctrine i18n生成器問題
(請看下面第一個編輯部分)
的模式是這樣的:
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,但空的名稱值。 即使當我嘗試通過ID和LANG直接選擇CargoSize對象來獲取名稱值時,getName()總是返回一個空字符串(DB用正確的數據正確填充)。
那麼是模式定義的一些worng?
第二個問題似乎與管理髮電機:
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: ~
有趣的是,該列表視圖顯示我的國際化名稱。但在編輯視圖中,我總是得到錯誤「小部件名稱」不存在「。
你們有什麼想法爲什麼發生這種情況?我會非常感謝你的幫助。
編輯:
我認爲這個問題坐鎮更深,因爲這個簡單的代碼和平做筆記的工作:
首先,數據集的例子:
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
是否有人有任何想法?我真的deperated :(
這很有趣,我已經有了toString。但是現在在添加embedI18n之後,所有問題似乎都可以解決,不僅在sfForm中,而且在O_o的獨立位置也是如此。所以thx很多這個提示:) – ownking 2010-09-02 10:32:53
這個問題仍然存在,我不知道爲什麼,但是當我想獲得名稱屬性: $ cargo_size-> getName(); //(這些值在每個語言的DB中) 它返回一個空字符串。 你有更多的想法可能是什麼問題? – ownking 2010-09-03 13:09:15