[CDBI] Connection with a fixed "where" clause.

William Ross will at spanner.org
Tue Aug 23 01:16:11 BST 2005

On 22 Aug 2005, at 08:36, Karl.Moens at marsh.com wrote:

> Hi ListMembers,
> Is it possible to have a class with a fixed "where" clause?


> I was thinking of the following situation. I have a big database  
> with a lot of customer related info (let's say ordering info). I  
> would like to have one Catalyst application to access this  
> database, but depending on who is using it, they should only be  
> able to see the records of one customer only.

...but it's a bad solution, in my opinion. What you're talking about  
here is a method, or a set of methods, in the Customer class. It's  
not a change to the system-wide search and retrieval mechanisms. All  
you need to do is call $customer->orders instead of calling Orders- 

> All I would have to do is to switch to another Model-class if the  
> customer changes. The way Catalyst works it would be transparent  
> for the rest of the application.

That sounds like a red flag, to me. I don't know catalyst at all, but  
shouldn't you be changing your view here, not your model?


More information about the ClassDBI mailing list