Adding A Persistent Filter Automatically

Good evening!

I have a quick question - what would be the best way to add a persistent condition to all SQL statements? I have a dataset that is separated by year. In Yii, I have configured the auth mechanism to request a year from a user before logging in. Once logged in, the user should NEVER see a different year on certain models.

I can add it to individual methods within the controller and this works, but I’m wondering if there is a rule I can set within the particular model?

Thanks!

What you are looking for is called scopes ;)

Aha! Perfect. Thank you very much!