Ok :) Using your terms, the following may be defined:

Owner hasMany Location, Location belongsTo Owner
Location hasMany Room, Room belongsTo Location
Category hasMany Room, Room belongsTo Category
Room hasMany Booking, Booking belongsTo Room
Renter hasMany Booking, Booking belongsTo Renter

Where:
Owner owns one or more locations, each with one or more rooms.
Location is a building, a camping field, whatever
Category gives the basic information on each room
Room defines a bookable room in a location
Renter makes a booking of a room.
Booking defines the actual request for a room. Booking also is used
for tracking the reply from the owner (status field) and final price
(price settled, price_type).

Database schema would be something like:
Booking (id, room_id, renter_id, arrival, departure, status, message,
price_type, price_settled, created, modified)
Location (id, owner_id, address, created)
Category (id, name, price_daily, price_weekly, price_forthnight,
price_monthly, occupants, created)
Room (id, location_id, category_id, description, created)

Well, the above is only ideas, so take what you can use! Probably you
also need something in which to track that the payment has been made.
Enjoy,
   John

On Dec 2, 10:31 pm, onlymejosh <[email protected]> wrote:
> These are the objects
>
> Renter, Owner, Room, Booking
>
> The number of guests isn't a factor.
> The booking invovles one room at a time. Its not a normal hotel per-
> say
>
> On Dec 2, 5:18 pm, John Andersen <[email protected]> wrote:
>
> > I see the following objects in your description:
> > Renter, Guest, Room, Owner, Booking
>
> > Can one room have more than one Guest per room?
> > Can one booking involve more than one room?
> >    John
>
> > On Dec 2, 5:42 pm, onlymejosh <[email protected]> wrote:
>
> > > Hi,
>
> > > I need some guidance on how to build these model relationships.
>
> > > I need to build something that allows people to book a room in an
> > > accommodation. These are the steps.
>
> > > User finds room.
> > > User requests to stay in room
> > > Owner accepts / declines
> > > User Pays / finds another room.
>
> > > I have 3 tables so far. Members, Accommodations, BookingRequests
>
> > > At the moment I have the foreign key member_id in Accommodation. Do I
> > > need to add it to BookingRequest as well?
>
> > > This is what I store in each.
>
> > > Members
> > > id,email,password
> > > Accommodation
> > > id,member_id,title,room_type,price,price_week,price_month
> > > BookingRequests
> > > id,accommodation_id,checkin_date,checkout_date,message,read,member_id
>
> > > The relationships are.
>
> > > Members hasMany Accommodation
> > > Accommodation hasMany BookingRequest, belongsTo Member
> > > BookingRequest belongsTo Accommodation.
>
> > > Any suggestions?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to