Hi all,

A bit irrelevant, but I'm using:
cakephp 1.2.7119 RC1
sqlite 2.8.17
PHP Version 5.1.2
on linux kernel version 2.6.15

I've made exactly one simple app using cakephp. That was only to input
some records to a single table.

I thought it was so easy that I'd use it for my next project, which is
amazingly simple:
an inventory

I have three tables:
unit - id, title, code
items - id, title, code
inventory - id, unit_id, item_id

Each unit(apartment) has some items, which is where the inventory
table comes it. I had to rename my inventory to pivots because somehow
inventory might be a reserved word or something. It will not find the
controller if it's named inventory.

Now I have:
CREATE TABLE units(id INTEGER PRIMARY KEY, code TEXT, title TEXT);
CREATE TABLE items(id INTEGER PRIMARY KEY, code TEXT, title TEXT);
CREATE TABLE pivots(id INTEGER PRIMARY KEY, unit_id INTEGER, item_id
INTEGER);

Everything was going fin untill I wanted to put some html select tags
on the add view for the pivots table. The docs don't say how I can
access data from another model - $this->set('units', $unit->Unit-
>findAll());. Of course it's not $this. I read the docs some more and
found out about ascociations. This is where hair begins to fall out.

I've been making DB apps for quite some time now and never used
something like this. It reminds me of MS Access. Ugh. Do I really need
to set this up? Will it be flexible in the end? What ascociation do I
use? I read about the hasAndBelongsToMany and the required join table.
It sounds like it's just what I want to do. Is it? Can I just Item-
>findAll() and pass the data to the view and put it in the html
select?

Sorry for the stream of questions. Thanks for the advice!

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