I have a table of ban reasons:
id | short_name | description
1 virus Virus detected in file
2 spam Spammy file
3 illegal Illegal content
When I ban a file for being a virus, in my code I do this:
$file -> banVirus();
Which inserts the file id and ban reason into a table:
"INSERT INTO 'banned_files' VALUES (61234, 1)"
My question is; is it a problem that I have hard-coded the value 1?, to indicate a spam file.
Should I use defines in my config like define ('SPAM', 1), so i can replace 1 with a define? Or does it not matter at all?
SPAMor1?1corresponds to an entry in your "ban reasons" table, so later maintainers know where to look... and since you're wrapping the insert in a function with a pretty descriptive name, that helps a lot tooshort_namethat keeps your database relational and normalised and gives you a descriptive ban reason when used elsewhere (in the application for example).