Check multiple beans if exists

17 views
Skip to first unread message

Crusifficadus CR

unread,
Nov 28, 2015, 3:17:54 PM11/28/15
to redbeanphp
Dear redbeaners,

I have some problem while trying to find an existed person in multiple beans. I'm looking for suggestion from you guys.

Here's the example :


apartment :
id
room
floor
pic (person in charge for general stuff)

hotel :
id
room
floor
pic
pqlty (pic for standards of quality)

What i'm trying to check is, if the John Doe exists in apartment_pic, he can't be a pic and/or pqlty in hotel bean and vise versa. what is the best option for this purpose? should i use many-to-many or just create some tags for those beans? Thanks.

gabor

unread,
Dec 4, 2015, 5:48:41 PM12/4/15
to redbeanphp


Why not invert the relationship:

person:
picplace_id = place.id

place
id
accomodation_type
room
floor
pqlty

cheers
Gabor
Reply all
Reply to author
Forward
0 new messages