Is there a way to go through all records of a model 1 by 1, but not just for displaying purposes?
I have a model which represent requests that need to be approved or rejected.
When approved, a new record will need to be created in a different model (depending on the request type) with data collected from the request and optionally extra fields will be required. When this new record is created, the initial request will be deleted.
When a request is rejected, the request just needs to be deleted (the easy part .
This will be done by multiple users. Since certain requests are better handled by another user, so the users need to be able to skip the current record and move on to the next one.
Maybe my approach to this problem is wrong, which forces me in trying something that can’t be done or shouldn’t be done. Any tips are welcome.
sorry - didn’t read your post to the end CDataProviderIterator is good to iterate all records programaticaly in a loop 1 by 1.
what you need is rather action that loads task and shows it to the user. Then user may interact with the task (approve/reject/skip), if he rejects/approves - action finds next free task. if user skips - action should find next unprocessed task following skipped one (using some order like: "select * from task where id > :skipid order by id limit 1"). and thats it.
another thing is resolving conflicts (when two users try to make decision on same task). You may here use optimistic or pesimistic lock pattern…