Is nobody able to suggest anything to help me with this?

Thanks

David

On Jul 28, 4:52 pm, DavidH <[email protected]> wrote:
> Hi
>
> I'm hoping someone will be able to put me out of my misery with this
> HABTM problem I have because it's doing my head in.
>
> I have an application to draw charts of key performance Indicators
> (KPIs). A chart can have many KPIs and a KPI can appear on many
> charts. So I have models:
>
> Chart
> Kpi
>
> and a HABTM relationship between them using a join table called
> charts_kpis. This all worked like a dream. I had a form that allowed
> the user to specify their chart details (title, size etc) and select
> which KPIs to display on the chart using checkboxes to select the
> KPIs. It was cool!
>
> The I started to add some additional attributes. For example a KPI can
> be displayed in a different colour on each chart and the lines/bar can
> be a different width. So I added some attributes to my charts_kpis
> table which now has the structure:
>
> id - PK
> kpi_id - references kpis table
> chart_id - references charts table
> kpi_colour_id - references kpi_colours table. A model exists for this
> and defines a hasMany relationship with charts_kpis table
> width - width to display this KPI on this chart
>
> Here I started to run into problems. In the end I dissolved the HABTM
> relationship between charts and kpis and resorted to:
>
> Chart hasMany ChartsKpi
> ChartsKpi belongsTo Chart
> Kpi hasMany ChartsKpi
> ChartsKpi belongsTo Kpi
>
> and, of course
>
> KpiColour hasMany ChartsKpi
> ChartsKpi belongsTo KpiColour
>
> However the lengths I've had to go to to get the add/edit forms to
> work (well, the edit form still isn't working right) leads me to think
> that I've really gone about this the wrong way. What I want is a form
> that allows the user to add/edit the chart details (in the charts
> table) at the top and below this to select the KPIs that they want
> (using a checkbox) and select the colour and set the width for the
> KPIs they've selected. (This is very difficult to describe without a
> picture). There's many more attributes to follow once I have this
> 'simple' case working.
>
> Should I have been able to do this using the original HABTM
> relationship?
>
> Thanks in advance
>
> David
--~--~---------~--~----~------------~-------~--~----~
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