Is it possible to add columns to a DBIx::Class::Row object that are virtual in that they are not saved to the database? I am looking for functionality like Rose::DB::Object provides through its non-persistent columns http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#nonpersistent_columns
Have you tried adding methods to the Result classes in your Schema? That might get you to the same place. The methods you add can't be used in ->search and won't be returned in ->get_columns, but depending on your use case, it may be enough.
I just had to look this up again as I had a need for it. You've probably got a solution already, but for others that come here looking: https://metacpan.org/module/DBIx::Class::Manual::FAQ#Misc
Basically either use Moose and create an attribute, or add something like this to your schema:
__PACKAGE__->mk_group_accessors('simple' => qw/non_column_data/); # must use simple group
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With