symfony i18n对象没有输出转义 [英] symfony i18n objects without output escaping
问题描述
我在Symfony 1.4和Doctrine中遇到问题,而不用输出i18n对象的价值。 > $ object-> getDescription(ESC_RAW); 以获取未转义的值。当我想要获得对象的特定翻译时出现问题。如何指定文化和转义策略?我没有找到任何有关这方面的文件。我可以传递多个参数作为数组或类似的东西: $ object-> getDescription(array('fr',ESC_RAW));
?
这是我的架构的相关部分:
对象:
actAs:
时间戳:〜
I18n:
字段:[名称,描述]
列:
名称:{type:string(255),notnull:true}
描述:{type:string(1000)}
user_id:{type:integer}
关系:
用户:{class:sfGuardUser,local:user_id,foreign:id,type:一个,foreignType:many,foreignAlias:Objects}
:
sfOutputEscaper :: unescape($ object-> Translation ['fr'] - > description);
I am having a problem in Symfony 1.4 and Doctrine with getting the value of an i18n object without output escaping.
Typically I just do this $object->getDescription(ESC_RAW);
to get the value un-escaped. The problem comes in when I want to get a specific translation of the object. How do I specify the culture and the escaping strategy? I haven't found any documentation on this. Can I pass multiple parameters as an array or something similar to this: $object->getDescription(array('fr', ESC_RAW));
?
Here's the relevant portion of my schema:
Object:
actAs:
Timestampable: ~
I18n:
fields: [name, description]
columns:
name: { type: string(255), notnull: true }
description: { type: string(1000) }
user_id: { type: integer }
relations:
User: { class: sfGuardUser, local: user_id, foreign: id, type: one, foreignType: many, foreignAlias: Objects }
Try:
sfOutputEscaper::unescape($object->Translation['fr']->description);
这篇关于symfony i18n对象没有输出转义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!