First we have to change the auto-generated file in apps/[APP]/modules/[MODULE]/actions/actions.class.php and to add a function "buildQuery()" to the [module]Actions-class:
class hotelActions extends autoHotelActions
{
protected function buildQuery()
{
$query = parent::buildQuery();
//Here you can extend your $query to filter the result.
return $query;
}
}
So if we have a "creator_id"-field in our schema and we want to filter the result to show only the entries created by the current user, we have to add the following code:
class hotelActions extends autoHotelActions
{
protected function buildQuery()
{
$query = parent::buildQuery();
$rootAlias = $query->getRootAlias();
$query->andWhereIn($rootAlias.'.creator_id', Array($this->getUser()->getGuardUser()->getId()));
return $query;
}
}