Skip to main content
Version: v0.2 (next)

Contracts Reference

Flare exposes a set of small interfaces that opt a filter element, list driver, or helper object into specific behavior.

Most custom filter elements extend AbstractFilterElement and most custom list drivers extend AbstractListDriver. Those base classes already implement several contracts with no-op or default behavior, so you only need to override the contracts that matter for your type.

Contracts are grouped into three categories:

1. Filter Element Contracts​

The element lifecycle interfaces live in HeimrichHannot\FlareBundle\Filter\Element\ and are covered in depth by the custom filter elements guide:

  • FilterElementInterface: The core contract every element implements — buildContext() translates config and the filter's value object into predicate calls. Presentation is the job of a filter control.
  • Capability ports (Contract\FilterElement\): ChoiceSourceContract (the element offers a set of choices) and DateBoundsContract (the element bounds a date range) — what controls and value providers pull from an element. Both take an ElementScope, so the element reads its own config with $scope->get(). See filter controls. IneffectiveFilterContract lets an element tell the backend why its filter restricts nothing as configured; see filter elements.

2. List Driver Contracts​

These live in HeimrichHannot\FlareBundle\Contract\ListDriver\:

  • BuildQueryContract: Register joins and customize the base SQL query.
  • BuildListContract: Take part in the list build lifecycle — buildList(ListSpecBuilder) adds filters or config overrides before the ListSpec is built (see the custom list drivers guide).
  • DataContainerContract: Resolve the list record's dc value during backend editing.

3. General Contracts​

These apply to filter elements and list drivers alike:

  • OptionsContract: Declare a canonical config schema with Symfony's OptionsResolver (configureOptions()).
  • TransformerContract: Declare per-source transformers translating a stored source (e.g. a DCA model) into canonical config values (configureTransformers()).
  • DcaContract: Assemble the type's backend palette and DCA field tweaks at runtime.
  • IsSupportedContract: Hide unsupported services from bundle integrations that check availability.