The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Rose::DB::Object::Metadata::ForeignKey - Foreign key metadata.

SYNOPSIS

  use Rose::DB::Object::Metadata::ForeignKey;

  $fk = Rose::DB::Object::Metadata::ForeignKey->new(...);
  $fk->make_method(...);
  ...

DESCRIPTION

Objects of this class store and manipulate metadata for foreign keys in a database table. It stores information about which columns in the local table map to which columns in the foreign table, and is responsible for creating an accessor method for the foreign object.

This class represents (and will create an accessor method for) the thing referenced by the foreign key column(s). You'll still need accessor method(s) for the foreign key column(s) themselves.

Both the local table and the foreign table will need Rose::DB::Object-derived classes fronting them.

Since there is a lot of overlap in responsibilities, this class inherits from Rose::DB::Object::Metadata::Column. Inherited methods that are not overridden will not be documented a second time here. See the Rose::DB::Object::Metadata::Column documentation for more information.

OBJECT METHODS

class [CLASS]

Get or set the class name of the Rose::DB::Object-derived object that encapsulates rows from the table referenced by the foreign key column(s).

key_column LOCAL [, FOREIGN]

If passed a local column name LOCAL, return the corresponding column name in the foreign table. If passed both a local column name LOCAL and a foreign column name FOREIGN, set the local/foreign mapping and return the foreign column name.

key_columns [HASH|HASHREF]

Get or set a reference to a hash that maps local column names to foreign column names in the table referenced by the foreign key.

method_maker_class

Returns Rose::DB::Object::MakeMethods::Generic.

method_maker_type

Returns object_by_key.

share_db [BOOL]

Get or set the boolean flag that determines whether the db attribute of the current object is shared with the foreign object to be fetched. If undefined, it is assumed to be true.

type

Returns "foreign key".

AUTHOR

John C. Siracusa (siracusa@mindspring.com)

COPYRIGHT

Copyright (c) 2005 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.