I need some suggestions from yii programmers 'cause i need to model a booking.
Conceptually i want to split the booking form into multiples steps:
1° Step: the user select the start date, the end date and the person’s number.
2° Step: for each person, the user has to select the age (adult, babies or over60)
3° Step: the user selects the room
4° Step: the user selects extra services
5° Step: the user inserts personal data for and confirm the reservation.
So i needs this models:
BookingReservation(id, start_date, end_date, person_number)
BookingRooms(id, id_booking_reservation, id_room, id_client)
BookingExtra(id, id_booking_reservation, id_extra)
Extra(id, name, price)
Room(id, name, description, price)
How many controllers you suggested to use?
I was thinking about a single controller and look into a variable $step:
if the form sends (with a hidden input) value: 1 i’m in the first step, if it’s 2 i’m in the second step and so on.
and the model?
is better to use multiple CFormModel, one for each step and save them into an ActiveRecordwhen reservation is completed?
or is better an ActiveRecord and manage validation with "scenarios"?