Hi,
I saw in the jobeet doctrine tutorial a method of having a function in
your form the would generate filenames for uploaded files:
if a generateLogoFilename() method exists in the form, it will be
called by the validator and the result will override the default
generated logo filename. The method is given the sfValidatedFile
object as an argument.
This wasn't working for me so I went to the source code and saw on
line, 503 of sfValidatorFile.class.php
else if (method_exists($this->object, $method)){
return $this->getValue($field)->save($this->object->$method($this->getValue($field)));
}
I changed this to :
else if (method_exists($this, $method)){
return $this->getValue($field)->save($this->$method($this->getValue($field)));
}
and now the code works the way the doc says (the function is in the
form class). The way the code was working the generate[column]Filename
() would have to be in the model class. I also noticed that the
function name is not expecting a camelCase version of the column name,
which sort of goes against convention.