Okay. This is probably me being exceptionally stupid.... but with
MySQL 5.0.22 (I know...) with this schema:
DROP TABLE IF EXISTS vendors;
CREATE TABLE vendors (
id SERIAL NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
UNIQUE(name)
) TYPE = InnoDB;
DROP TABLE IF EXISTS products;
CREATE TABLE products (
id SERIAL NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
vendor_id INT REFERENCES vendors (id),
UNIQUE(name)
) TYPE = InnoDB;
if I run this code:
{ package My::DB;
use base qw( Rose::DB );
__PACKAGE__->use_private_registry;
__PACKAGE__->register_db(
domain => 'test',
type => 'main',
driver => 'mysql',
host => 'localhost',
database => 'rdbo_test',
username => 'user',
password => 'password',
);
__PACKAGE__->default_type( 'main' );
__PACKAGE__->default_domain( 'test' );
};
use Rose::DB::Object::Loader;
my $db = My::DB->new;
my $loader = Rose::DB::Object::Loader->new(
db => $db,
class_prefix => 'My'
);
$loader->make_classes;
my $p = My::Product->new( name => 'Foo' );
$p->vendor( name => 'Bar' );
I get this
Can't locate object method "vendor" via package "My::Product" at
/usr/local/lib/perl5/site_perl/5.8.8/Rose/DB/Object.pm line 1500
where I expect it to DWIM.
Can somebody point me to my stupidity...
Ta,
Adrian
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object