I'm using Symfony 1.4 with Doctrine in a project where users can upload an image as avatar. I don't want to store the filename in db but a boolean value. That's my relevant schema.yml section:
nyUserProfile:
...
has_avatar:
type: boolean
notnull: true
default: false
I overwritten the sfValidatedFile save method just to save some thumbnails with no call to parent::save function because I dont care about the original file:
// Creamos los thumbnails
$config = sfConfig::get('app_images_avatars');
$original = new sfImage($this->getTempName());
foreach($config['sizes'] as $thumbnail_name => $thumbnail_info){
$thumb = $original->copy();
$thumb->setQuality($thumbnail_info['quality']);
$thumb->thumbnail($thumbnail_info['width'],$thumbnail_info['height'],$thumbnail_info['method'],'#000000');
$thumb->saveAs($this->getPath() . DIRECTORY_SEPARATOR . $file . '_' . $thumbnail_name . $thumbnail_info['extension'],$thumbnail_info['mime']);
}
That works fine saving thumbs but boolean false value is stored into db at field has_avatar, I guess that's because parent::save method is not called at all but you know, I dont want to store the original file, just make thumbnails from it.
Is there a method to manually set the value stored in db just in case the image succesfully passed the validator tests?