Is there an example of how to create a new entity in a scheduled job? I see a lot of examples of DELETE and SELECT, but I need to insert new rows. Basically, it would be like clicking the 'Create xxxxxx' button in the UI and then filling out some fields before hitting save. I think I need to use getEntityManager or getEntity, but I can't find any documentation or tutorials explaining how either of those functions work.
I'm trying to create a 'Timesheet' entity for each user who has 'hasTimesheet' = true in their 'User' object. In pseudocode:
I'm trying to create a 'Timesheet' entity for each user who has 'hasTimesheet' = true in their 'User' object. In pseudocode:
Code:
for each user where user.hasTimesheet = true: create new Timesheet and set a few fields save timesheet
Comment