March 18th, 2010, 12:07 PM
Data Mapper and Related Objects
I'm developing a employee record tracking application, and I'm having difficulties wrapping my head around the design approach I should take.
One of the things I'll be tracking is an employee's attendance. The Attendance table in the database has an auto-incrementing primary key, the ID of the employee, the ID of the person recording the issue, the date, and some comments. The ID of the employee is a foreign key to the Employee table, and the recorder's ID is a foreign key to the Users table.
In my code, I'm creating an Attendance object and an Attendance mapper. But I'm not sure exactly about what type of data should be in the Attendance object. Should I be storing the employee ID, or should I be storing an Employee object? Or am I way off base here?
March 18th, 2010, 02:05 PM
Date only or time included?
You'll need to check the ORM that you use. The documentation should indicate how foreign keys are specified.
Don't guess. Check documentation.
When you ask a question, be prepared to tell us: what have you tried? If you think you don't need to try anything, we will never be interested in helping you. If you agree with the link, and you refuse to answer that question, you are being a hypocrite.
Need help with broken code? Your question should be like a good bug report: (1) It has the smallest number of steps to reproduce the problem you see (2) It tells us precisely what you expected to see and (3) It tells us what you saw and how it differed from what you expected. We need all three to help you.
Want better answers? Tell us what you Googled for and what steps you took to answer your own question.