DoctrineExtensions
DoctrineExtensions copied to clipboard
Uploadable not working for ODM
Hello,
If you are using ODM, you can't use UploadableFileSize because of error:
Field "size" to work as an "UploadableFileSize" field must be of one of the following types: "decimal".
If you check Gedmo\Uploadable\Mapping\Validator.php you can see, that variable $validFileSizeTypesODM have no usages.
From Validator.php:
/** * @param string $field * * @return void */ public static function validateFileSizeField(ClassMetadata $meta, $field) { self::validateField($meta, $field, self::UPLOADABLE_FILE_SIZE, self::$validFileSizeTypes); }
You should check for if you are in ODM or ORM. Can you fix it or tell, how to do it?
Hi @spin7ion, apparently there is no support for ODM in Uploadable extension, I haven't used it so I'm not sure how hard would be to make it compatible with both ORM and ODM.
For this specific case, you could add float
to $validFileSizeTypes
, I think that's the way it's done in other extensions, but you will need to change more things apart from the Validator.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.