[Maypole] Maypole::Plugin::Relationships and YAML

From: Dana Hudes (dhudes at hudes.org)
Date: Tue Feb 01 2005 - 17:03:17 GMT


First off, I want to note for anyone fooling with YAML: do not try to use
TAB to indent. YAML won't like it, use only spaces.

Now to the main point:
I'm trying to use Maypole::Plugin::Relationship with YAML
so I have

use Maypole::Application qw(Config::YAML Loader Untaint Relationship
-Setup);

in my main module.

I'm using Postgresql.
I'll simplify my data model (!) for a similar example. Let us say I have
clothes and I wish to use a controlled vocabulary for color (e.g., the
Pantone colors so that I have an exact specification of color). So of
course the color table has the structure
TABLE colors (
ident SERIAL NOT NULL PRIMARY KEY,
name VARCHAR(32) NOT NULL,
C int2,
M int2,
Y int2,
K int2
);

TABLE clothes (
ident SERIAL NOT NULL PRIMARY KEY,
name VARCHAR(32),
color integer,
designer VARCHAR(64), -- really should be a CV also but for simplicity
FOREIGN KEY ("color") REFERENCES "colors"("name")
);

and then in my YAML spec, after the dbi config (which is fine, if
it didn't work it would object)
relationships:
   -a clothes has colors

Now, the stock CDBI::Relationship::HasA will just bark "has_a needs a
valid column" and if you've got multiple columns and multiple tables
you're left wondering just what's the problem , exactly.
So I've made a mod to HasA.pm to spit out the class nam and the candidate
column name to which it objects. I'll send that to the CDBI list.
After my mod, it tells me that its objecting to class (table) Colors
and column clothing !

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT