So, I've been pulling my hair out trying to figure out how to do this,
reading everything on pagination in CakePHP 1.2...

So here's a quick explanation of my setup, then I'll explain what
effect I want to achieve.

I have a table of items which looks something like (this is
simplified):

--- items -------------------------------
|  id  |  name  | description | price |
-------------------------------------------
|  5   |   test    | some desc | 2.50 |
--------------------------------------------

Then there's a table called descriptors (other useful things to
describe items):

--- descriptors ----
| id |  name |        |
-----------------------
| 1  |  color  |        |
-----------------------

Then the join table or what have you (this is part of the kicker):
--- descriptors_items --------------------
| id | item_id  |  descriptor_id |  value |
------------------------------------------------
| 1  |     5       |             1         |  blue   |
------------------------------------------------

What I want to be able to do is create extra descriptors for items
that function as table headers in the view ultimately.  This way, for
instance, I could have items sorted by color in a table.  Later, if I
need an additional way to describe a product (like size), I can just
create another descriptor and be done with it.  No table editing.

I figured out how to get the "value" field from the join table with
some array mucking around at Mariano's site:

http://cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1

As well as how to sort by HABTM at :

http://www.littlehart.net/atthekeyboard/2007/12/11/cakephp-pagination-with-a-habtm-relationship/

What the latter site seems to buy me is being able to  sort items that
have the same Tag, rather than using the tag name as an actual
clickable field.

I recall reading somewhere about being able to swap columns for rows
in SQL, through some sort of crazy join I imagine.  Will I ultimately
end up needing to create a SQL view of my data like this and modelize
it?  It would be great if there's a CakePHP way to do it.


Thanks for your time,
-Kris

--~--~---------~--~----~------------~-------~--~----~
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