getSearchFields example


    protected function getIdentifierColumn()
    {
        return 'id';
    }

    /** * @return BuilderInterface */
    protected function buildSearchQuery(SearchCriteria $criteria)
    {
        return $this->searchQueryBuilder->buildQuery($this->getSearchFields()$criteria->term);
    }

    /** * @return array */
    protected function getSearchFields()
    {
        return ['swag_all' => 1];
    }

    protected function addSortings(SearchCriteria $criteria, Search $search)
    {

        $builder = $this->entityManager->createQueryBuilder();
        $builder->select($this->getIdentifierField());
        $builder->from($criteria->entity, 'entity');
        $builder->setAlias('entity');

        return $builder;
    }

    protected function addSearchTermCondition(SearchCriteria $criteria, QueryBuilder $builder)
    {
        $this->searchBuilder->addSearchTerm($builder$criteria->term, $this->getSearchFields($criteria));
    }

    /** * @return string[] */
    protected function getSearchFields(SearchCriteria $criteria)
    {
        $classMetaData = $this->entityManager->getClassMetadata($this->entity);

        return array_map(function D$field) {
            return 'entity.' . $field;
        },
Home | Imprint | This part of the site doesn't use cookies.