Something like this should work:
<?php
$AgencyCustomers = Customers::find();
?>
<?php
class Customers{
function find($criteria = ['conditions'=>'']){
$loggedInUserAgencyID = $_SESSION['agency_id'];
if(isset($criteria['conditions'])){
$criteria['conditions'] .= ' AND agency = :agency:';
else{
$criteria['conditions'] = 'agency = :agency:';
}
if(isset($criteria['bind'])){
$criteria['bind']['agency'] => $loggedInUserAgencyID;
}
else{
$criteria['bind'] = ['agency'=>$loggedInUserAgencyID];
}
return parent::find($criteria);
}
}
This assumes you're storing the user's agency id in $_SESSION. I'd recommend this because otherwise you'll have to do a query to find the user's agency id, each time you query for Customers. The agency ID doesn't change, so you might as well just look it up once and store it.