From: Chris W. <ch...@cw...> - 2004-07-05 12:58:08
|
On Jul 4, 2004, at 6:26 AM, Antti V=E4h=E4kotam=E4ki wrote: > Sorry to bother you.. I'm tired after a night of coding and thus=20 > probably I'm just missing the documentation or the google page. > > Would someone please point out where it is described how to create=20 > has_a configurations with OpenInteract2 ini files which correspond to=20= > the example shown in SPOPS::Manual::Relationships : > > has_a =3D> { 'My::User' =3D> { updater =3D> 'updated_by' } }, Sorry for the delay -- I'm in the middle of moving to a new house. This functionality is not in the current OI2. However, adding some=20 rules to fake it isn't too hard. Try out the attached class OpenInteract2::Config::Initializer. This has=20= a bunch of small actions that get run after the configuration has been=20= read and parsed but before it's passed off to the relevant processing=20 code. (In this case: SPOPS::Initialize.) Here's the POD for the changes: ---------- =3Ditem B<'has_a' Munging> Because we have restricted configurations to three levels deep some features cannot be adequately representetd. Complicated 'has_a' relationships are one of these. In the Perl data structure you might have something like: { user =3D> { ... has_a =3D> { 'My::User' =3D> { updater =3D> 'updated_by', poster =3D> 'posted_by', }, }, } But if you try to do this with an unmodified configuration you will get this far: [user has_a] My::User =3D ARGH! Instead you can use a shortcut: [user has_a] My::User =3D updater: updated_by; poster: posted_by So each name and field is separated by a ':' and each set is separated by a ';'. Alternatively you can also represent them as a list: My::User =3D updater: updated_by My::User =3D poster: posted_by And the system will do the right thing. ---------- If this seems to work for you I'll do the same for 'links_to' sections. Thanks, Chris -- Chris Winters Creating enterprise-capable snack systems since 1988 |