Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 805 Bytes

filter.md

File metadata and controls

27 lines (22 loc) · 805 Bytes

Filter

A Filter, as the name says, filters your data on runtime. Your method gets called on every "row" and you get to decide if you want to import it, or not.

To implement a new filter, you need to implement the interface Instride\Bundle\DataDefinitionsBundle\Filter\FilterInterface and add a new service

acme_bundle.data_definitions.my_filter:
    class: AcmeBundle\DataDefinitions\MyFilter
    tags:
      - { name: data_definitions.filter, type: my_filter }
namespace AcmeBundle\DataDefinitions;

class MyFilter implements FilterInterface
{
    public function filter($definition, $data, $object) {
        if($data['isActive'])
        {
            return true;            //Will be imported
        }

        return false;               //Will be ignored
    }
}