【发布时间】:2010-02-01 12:55:13
【问题描述】:
假设一个 Doctrine 模型Profile:
# This is example of my schema.yml
Profile:
columns:
avatar:
type: string(255)
notnull: true
我的目标是从上传的文件中生成个人资料的头像:
class Avatar extends BaseAvatar{
public function postSave($e){
if($this->getAvatar()){
// resize/crop it to 100x100
// and save
}
}
这个逻辑现在对我来说很好。但是我的Profile 关联记录会在每次请求时更新,并提供一些额外的信息。而且,如您所见,尽管avatar 字段可能保持不变,但会一遍又一遍地生成头像文件。
问题:框架如何判断特定字段是否更新?
注意:我不需要更新 symfony 的操作,因为代码在多个应用程序中重复。还是我需要?
【问题讨论】:
标签: model symfony1 doctrine image-manipulation