[Dbix-class] Left join with an extra condition

Wallace Reis wallace at reis.org.br
Sat Oct 24 15:24:32 GMT 2009


On 24/10/2009, at 11:48, Bill Moseley wrote:

> Can the virtual view inherit from the user?  That is, can I convince  
> DBIC that the object returned is a real user object so I can update  
> the object and have it written to storage?  The cookbook just says  
> that the view cannot be operated on.  Obviously, it would be much  
> more useful to have a real user object.

You can do it if you use a DBMS with RULEs support (like PostgreSQL).
Or you can setup a belongs_to rel (where is_foreign_key_constraint =>  
0) to the user and override qw/insert delete update/ row methods in  
your view class to do such operations on ->referred_user instead of  
$self, like you would do with RULEs on DBMS.

--
    wallace reis/wreis         Catalyst and DBIx::Class consultancy  
with a clue
    Software Engineer          and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk     http://www.linkedin.com/in/wallacereis



More information about the DBIx-Class mailing list