On 19 Dec 2005, at 21:38, Aaron Trevena wrote:

On 19/12/05, Kieren Diment <[EMAIL PROTECTED]> wrote:
Strange problem has cropped up in re-structuring my application.
[ snip ]
Now it's in lots of files, so:
[ snip ]
Now it ain't working properly - I just get the primary key value in
the newer version.

The ordering of module loading can affect relationships, this would
have changed if you split into files from a single file.


Cool This is what I thought. I was just being insufficiently systematic.


Are you setting all of the relationships, and loading the classes
explicitly? If so it might be worth changing the order in which you do
so.

Close, but only 1/2 a cigar :)


I moved all the relationship stuff out of the subclasses and stuck them back in the base class, so everything except the relationships is in the subclass, so:

CokeWorks->setup("dbi:mysql:coal", "root", "");

CokeWorks::Category->require;

CokeWorks::AuthRoles->require;
CokeWorks::AuthRoles->has_many(user => [ 'CokeWorks::RoleAssignments' => 'user_id' ]);

CokeWorks::User->require;
CokeWorks::User->has_many(auth_roles => [ 'CokeWorks::RoleAssignments' => 'auth_role_id' ]);

CokeWorks::AccessType->require;

CokeWorks::RoleAssignments->require;
CokeWorks::RoleAssignments->has_a(user_id => 'CokeWorks::User');

# etc ...

And this worked fine. Note the call to setup before all the - >require; stuff. So buoyed on by this success, and knowing that I had all the require statements in the right order, I moved all the relationships stuff back into the subclasses, and....

it broke. Anyway, the approach I've taken seems to work and has the advantage that the naming of dependencies is explicit and so much more self documenting.

Cheers for the pointer.

kd


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Maypole-users mailing list
Maypole-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to