[Dbix-class] help with dbix::class syntax

jagdish eashwar jagdish.eashwar at gmail.com
Sat Dec 29 15:26:28 GMT 2007


Hi,

I am writing a small catalyst application for online maintenance of leave
records at the office. I need to ensure that a dept head is not flooded with
all the leave applications, but gets only those pertaining to his dept. I
have a users table and a leave_application table. The first table contains
the user_id, user_name and dept_id columns, while the second one contains
the user_id and leave_id columns. I have declared a has_many relationship
named 'leave_apps' and  a belongs_to relationship named 'usr' between the
two tables. I am unable to put the following SQL query into DBIx::Class
syntax.

select l.leave_id from leave_application l,
    users u,
where u.user_id =3D l.user_id
and u.dept_id =3D $dept_id_of_dept_head;

In catalyst, I pick up the dept_id_of_the_dept_head by using
'$c->user->dept_id'.

Can someone help me please?

jagdish eashwar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20071229/1fe=
e330b/attachment.htm


More information about the DBIx-Class mailing list