[Dbix-class] How to create a row object that contains related objects in DBIx::Class?

Eugene Yarmash e.yarmash at gmail.com
Thu Aug 16 07:38:12 GMT 2012


Hello and thank you to everyone who takes part in the development of 
DBIx::Class. I have a question (also posted at SO 
http://stackoverflow.com/q/11970939/244297).

When you create a Row object in DBIx::Class you can pass related objects 
as values, e.g.

my $author = $authors_rs->find(1);
my $book = $books_rs->create({ author => $author, title => 'title' });

However, if you later use the author accessor, the object is retrieved 
again from the database. Is it possible to create an object so that the 
related object can be accessed without the additional query?



More information about the DBIx-Class mailing list