With a table homes_images

id
home_id
image_id
ordering

An image can be assigned to many houses but each house will have an
independent ordering.  You will have to look into the hasMany, it has
an order option but I'm not positive on how to use it, maybe someone
else can give you a pointer on that.

You also might need to do a manual insert of the ordering in the
afterSave callback.

Sorry if that seems a bit vague, I've never had to do this in cake,
but it is how I would look at tackling it.

Geoff
--
http://lemoncake.wordpress.com

On Jul 4, 11:45 pm, McFadly <[EMAIL PROTECTED]> wrote:
> Hi Geoff,
> Thanks for the response.  Your solution would be fine if I didn't have
> the stock images in the mix.  Some images will be associated with
> multiples homes, so I think I need to have a separate table that is
> somehow keeping track of what homes they are associated with, in
> addition to what order they appear in for that particular home.  Just
> not quite sure how to pull this off...
>
> On Jul 3, 8:11 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > What about a field in the images table that is used for ordering and
> > then use 'Images.order_field' as the 3rd parameter in your findAll()
>
> > Geoff
> > --http://lemoncake.wordpress.com
>
> > On Jul 4, 11:14 am, McFadly <[EMAIL PROTECTED]> wrote:
>
> > > Hello Bakers -
>
> > > I have a situation where I can't agree on the best database schema /
> > > logic for my project.
>
> > > Here's a simplified version of my project:
>
> > > table: Homes
> > > table: Images
>
> > > Each Home will have zero to many Images.  Some Images will be "stock"
> > > images that can be used by many Homes.  Each group of Images
> > > associated with a Home will be in a user defined and changeable
> > > order.
>
> > > Homes HABTM Images would provide the ability to associate images to
> > > homes, but how do I keep them in a specific and changeable order?
>
> > > My initial thought is a table: galleries, which has a serialized list
> > > of image_ids, in a particular order.  Is this my best bet, or am I
> > > overlooking a possibility?
>
> > > Your thoughts and direction, please.
> > > Thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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