【发布时间】:2014-01-31 02:14:45
【问题描述】:
我想覆盖关联附带的 getter 方法(hasMany、belongsTo、hasOne)。似乎在创建实际 getter 的地方发生了一些魔术,在查看了代码之后,我不确定从哪里开始。我查看了Ext.data.association.Association's constructor,但无法推断出 getter 的创建位置。
假设我有一个类似这样的 hasMany 关系:
hasMany: [
{associationKey: 'services', name: 'getServicesStore', model: 'Service'},
{associationKey: 'standards', name: 'getStandardsStore', model: 'Standard'}
]
当我调用getServicesStore 和getStandardsStore 方法时,我想向控制台输出一些东西,但我希望这两种方法都输出相同的东西,所以我希望它们都继承自同一个 Associations 类,但在某个地方,覆盖关联代码。
我知道我的例子可能有点傻,但除了控制台日志之外,我还有其他计划。如果有人能就从哪里开始提供任何指导,我将不胜感激!
来自Sencha forums的交叉帖子。
【问题讨论】:
标签: extjs model associations has-many extjs4.2