Why not create another result class for the different table?
The overlapping methods can be put in a base class or a role used by both.

Am 2011-05-17 17:14, schrieb Bill Moseley:


On Tue, May 17, 2011 at 7:43 AM, Peter Edwards 
<[email protected]<mailto:[email protected]>> wrote:
Can you say

my $search_attr = {
 '+columns'  => [ { 'email' => \'' } ], # and so on for other missing fields
};

then

my $rs = $schema->search_rs( $query, $search_attr );

Hi Peter,

Maybe I'm not understanding your suggestion.  The problem I have is an existing application that uses 
DBIC, and (perhaps incorrectly) there's quite a few direct uses of $user->get_column( 'email' ),  I 
could probably replace those in the app by adding, for example, an "email" method to the 
result class.   There's also other uses of the "email" column such as create() and maybe 
other resultset methods that verify that every key in the passed in data is an actual column.

I suspect replacing the get_column() usage is necessary.  But, I'm not sure how 
best to deal with any other methods that might reference a non-existent column.

Really, what I need to do is prevent the column from ending up in SQL.  So, 
could I defined the non-existent column in the result class and then override 
the SQL generation somewhere to strip out the columns?  I suspect that's less 
that trivial.

Other option would be to override insert and create and strip out the 
non-existent columns.

Unfortunately, I can't just add the columns to the database.

Any other ideas?

Thanks,



--
Bill Moseley
[email protected]<mailto:[email protected]>

*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to