Escaping modelName for a valid PHP variable name

When you have a object in database whose ID is a string, and it includes spaces, dashes or accentuated letters, the generated PHP is not valid.
Here is a first approximation for removing the non-valid characters.