searchTerm = $searchTerm; } public static function create(): self { return new self(); } public static function createForSearchTerm(string $searchTerm): self { return new self($searchTerm); } public function getSearchTerm(): ?string { return $this->searchTerm; } public function hasSearchTerm(): bool { return $this->searchTerm !== null; } public function getFolder(): ?Folder { return $this->folder; } public function getFirstResult(): ?int { return $this->firstResult; } public function getMaxResults(): ?int { return $this->maxResults; } public function getSearchFields(): ?array { return $this->searchFields; } public function getOrderings(): ?array { return $this->orderings; } public function isRecursive(): bool { return $this->recursive; } public function withSearchTerm(string $searchTerm): self { $demand = clone $this; $demand->searchTerm = $searchTerm; return $demand; } public function withFolder(Folder $folder): self { $demand = clone $this; $demand->folder = $folder; return $demand; } /** * Requests the position of the first result to retrieve (the "offset"). * Same as in QueryBuilder it is the index of the result set, with 0 being the first result. */ public function withStartResult(int $firstResult): self { $demand = clone $this; $demand->firstResult = $firstResult; return $demand; } public function withMaxResults(int $maxResults): self { $demand = clone $this; $demand->maxResults = $maxResults; return $demand; } public function addSearchField(string $tableName, string $field): self { $demand = clone $this; $demand->searchFields[$tableName][] = $field; return $demand; } public function addOrdering(string $tableName, string $fieldName, string $direction = 'ASC'): self { $demand = clone $this; $demand->orderings[] = [$tableName, $fieldName, $direction]; return $demand; } public function withRecursive(): self { $demand = clone $this; $demand->recursive = true; return $demand; } }