private function _castToGenre($submissionFile)
{
// Find the required target implementation.
$targetImplementation = strtolower_codesafe($this->_getFileImplementationForGenreId($submissionFile->getGenreId()));
// If the current implementation of the updated object
// is the same as the target implementation, skip cast.
if (is_a($submissionFile, $targetImplementation)) {
return $submissionFile;
}
// The updated file has to be upcast by manually
// instantiating the target object and copying data
// to the target.
$targetDaoDelegate = $this->_getDaoDelegate($targetImplementation);
$targetFile = $targetDaoDelegate->newDataObject();
$targetFile = $submissionFile->upcastTo($targetFile);
return $targetFile;
}