Hello, guys!
Assume a Doctrine model Profile
:
# This is example of my schema.yml
Profile:
columns:
avatar:
type: string(255)
notnull: true
My goal is to generate profile's avatar from uploaded file:
class Avatar extends BaseAvatar{
public function postSave($e){
if($this->getAvatar()){
// resize/crop it to 100x100
// and save
}
}
That logic is fine for me now. But my Profile
associated record is updated on every request with some extra info. And, as you can see, avatar file is generated over and over in spite of the fact that avatar
field may stay the same.
Question: How can framework determine whether the particular field is updated or not?
Note: I don't need updating in symfony's actions because of code repeating in several apps. Or maybe I need?