Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as PHP by potato ( 7 years ago )
public function listProjectsWithTemplate(int $id, QueryFilters $filters, ListDecoratorInterface $decorator, CriteriaBuilderInterface $criteriaBuilder): DecoratorInterface
    {
        $template = $this->templateRepository->find($id);
        if (!$template instanceof Template) {
            throw new ConstraintValidationException(['Template with ID: ' . $id . ' not found']);
        }

        $criteriaBuilder->addEquals('templateName', CriteriaValue::createFromNative($template->getName()));
        $this->addSearchKeywordToQueryBuilder($filters, $criteriaBuilder);
        $findByResult = $this->elasticSearchProjectRepository->findByCriteriaBuilder($criteriaBuilder);
        $decorator->setEntities($findByResult->getEntities());

        if ($decorator instanceof ListWithPaginationDecoratorInterface) {
            $decorator->setPaginationDTO($findByResult->getPaginationDTO());
        }

        return $decorator;
    }

 

Revise this Paste

Your Name: Code Language: