[Dbix-class] fake column(s)

Seth Daniel dbix-class at sethdaniel.org
Thu Jun 16 20:41:28 GMT 2011


Hi,

I've been attempting to come up with some way to have DBIC columns that
don't get passed to update, insert, or search operations.  These must
look like actual columns (has_column should return true) so creating
accessors is no good.  I have this requirement because a third party
module sitting above the DBIC layer expects has_column to work for all
listed fields.

I looked at DBIx::Class::VirtualColumns but it comes with new API
methods (has_any_columns, has_virtual_columns) and doesn't/can't
override has_column.  

I also did an experiment where I used DBIC::Helper::RS::AutoRemoveColumns
to remove certain columns from search operations and overrode update and 
insert in the result class.  In these result classes I simply removed
some columns and then added them back after the operation was complete.  This 
didn't work either.  It seems that sometimes the update or insert
operations in the result subclass weren't being called which resulted in
the unwanted columns ending up in insert and update operations.  I didn't
investigate further.

I read http://lists.scsys.co.uk/pipermail/dbix-class/2011-May/009935.html
(Subject: Dummy DBIC columns?) with some interest, but it didn't seem to
come to any conclusions.

Is there a way to do this?  Or something that achieves the same result?

Thanks.

-- 
seth /\ sethdaniel.org



More information about the DBIx-Class mailing list