Can you also post the table definitions? (Simplified, if necessary.)
On 5/17/07 5:19 PM, Wiggins d'Anconia wrote:
> 'company_branches' stores a one-to-many of companies to their branches.
> 'user_company_map' stores what I thought would originally be a many-to-many
> between the users and the companies they have access to.
> 'user_company_branch_map' would then store a many-to-many between the
> company+user that has access to a specific branch of said company.
Do you need both user_company_map and user_company_branch_map tables? IOW,
does a record in user_company_map mean that a user has access to all
branches of a particular company? To none? Just to the "main office",
which is not a branch? What does it mean to have a user_company_map record
but no user_company_branch_map record?
> I end up with:
>
> Can't locate object method "add_restricted_branches" via package
> "M::Company::User"
>
> Methods for the following relationships and foreign keys were deferred and
> then never actually created in the class M::Company::User.
>
> TYPE NAME
> ---- ----
> Relationship restricted_branches
That error means that the "restricted_branches" relationship that you tried
to define in M::Company::User never had sufficient information to actually
connect both ends. In this case:
> restricted_branches => {
> type => 'one to many',
> class => 'M::Company::User::Branch',
> },
it's because you forgot to include a column_map in your relationship
definition. Change that to:
restricted_branches => {
type => 'one to many',
class => 'M::Company::User::Branch',
column_map => {
username => 'username',
company_code => 'company_code',
},
},
and $company_user->add_restricted_branches() should now work.
Though I hope that solves your immediate problem, I still think the table
layout is not quite right. But maybe I don't quite understand the business
relationships...
-John
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object