Now we use an ftype field int type in the mysql database table to identify the type. at this time, there are about 20 types. because of the long term, various numbers in the program seem very laborious. How do you deal with such problems in the program? Now the idea is... now we use an ftype field int type in the mysql database table to identify the type. at this time, there are about 20 types. because of the long term, various numbers in the program seem very laborious.
How do you deal with such problems in the program?
Now we are thinking:
Restrict programmers to use numbers to add tags without authorization, and add a class such:
class action{ const EDIT = 0; const VIEW = 1; //...}
All must be used by the parameter action class.
2. use the open-source enumeration class on github for implementation.
Such as: https://github.com/myclabs/ph...
Reply content:
Now we use an ftype field int type in the mysql database table to identify the type. at this time, there are about 20 types. because of the long term, various numbers in the program seem very laborious.
How do you deal with such problems in the program?
Now we are thinking:
Restrict programmers to use numbers to add tags without authorization, and add a class such:
class action{ const EDIT = 0; const VIEW = 1; //...}
All must be used by the parameter action class.
2. use the open-source enumeration class on github for implementation.
Such as: https://github.com/myclabs/ph...
Enumeration classes are a good choice, especially when the entire project tends to be object-oriented.
The two methods you listed are similar, except that the enumeration class provides more functions.
Select based on your actual needs.