i have the 2 packages below
        Asset
        AssetType

Asset is basically
        name
        id
        type_id

where type_id is a fkey to another table

when i pull a record for Asset or join onto asset from another table, i need to get the asset_type_id name sometimes i pull a record for something that is linked to Asset - so i'll need to delve 2 tables down

doesn't anyone know of a rose-db supported mechanism for this?
rose seems to have everything imaginable in it. i'm sure i'm just not picking it up from the docs.

my class structures are belwo

======
package MyApp::RoseDB::Asset;
use base qw(Rose::DB::Object);

use MyApp::RoseDB;

__PACKAGE__->meta->table('asset');
__PACKAGE__->meta->columns(qw(id asset_type_id name));
__PACKAGE__->meta->primary_key_columns('id');
__PACKAGE__->meta->add_unique_key('name');
__PACKAGE__->meta->foreign_keys
(
  asset_type =>
  {
        class => 'MyApp::RoseDB::AssetType',
        key_columns => { asset_type_id => 'id' },
  },
);
__PACKAGE__->meta->initialize( replace_existing  => 1 );
sub init_db { MyApp::RoseDB->new }
1;



package MyApp::RoseDB::AssetType;
use base qw(Rose::DB::Object);
use MyApp::RoseDB;
__PACKAGE__->meta->table('asset_type');
__PACKAGE__->meta->columns(qw(id name));
__PACKAGE__->meta->primary_key_columns('id');
__PACKAGE__->meta->add_unique_key('name');
__PACKAGE__->meta->initialize( replace_existing  => 1 );
sub init_db { MyApp::RoseDB->new }
1;




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to