Accessing Helpers and Model from custom Filter class

Hello,

I’ve write a custom filter to better filter some tasks, but I need to access the DB and some user’s info in my filter so I can find out what is user’s group ID.
Any help on how can I access Helper classes in a Filter class is really appreciated.

Kind regards

To fiddle in the DB, see link

You can use a method in a model via
$this->modelName->function() you’ll need to use it in a class
Or if in a view
$this->task->modelName->function()

For a helper
$this->helper->helperName->function()

Some helpers may have a shortcut…not goin through all of them. e.g. $this->text not $this->helper->textHelper

p.s. users can be in multiple groups, so you will have to get an array of groups for a user, and I dont believe there is a model with that method already in existence.

Thanks, but none of these worked for Filter class, for filter class I used code below to solve my problem pretty much like what Kanboard used in it’s own code:
$this->container->extend(‘taskLexer’,function($taskLexer, $c) {
$filter = TaskPermissionFilter::getInstance($c)->setContainer($c);
$taskLexer->withFilter($filter);
return $taskLexer;
});

And inside the Filter I’ve implement a setContainer method to access the Container dictionary from inside Filter class, therefor in Filter code I can use $this->container[‘db’] or $this->continaer[‘helper’]

Your probably doing it wrong, or im not understanding what your asking. I would need to see your code to understand. But, if you solved it, congrats.