grav-plugin-api icon indicating copy to clipboard operation
grav-plugin-api copied to clipboard

refactor: move setFilter to Resource class

Open Regaez opened this issue 5 years ago • 0 comments

Perhaps the setFilter function could be moved into the abstract Resource class and made to be generic, so it's not repeatedly defined in all the different resource types, e.g.

protected function setFilter()
{
    $filter = Config::instance()->{$this->getResourceType()}->get->fields;
    
    if (!empty($filter)) {
        $this->filter = $filter;
    }
}

Then would need to adjust mapping so that getResourceType() returns the correct value for the config... currently would return user not users etc

Regaez avatar Aug 21 '19 07:08 Regaez