ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MetaData\Copyright\Search\Searcher Class Reference
+ Inheritance diagram for ILIAS\MetaData\Copyright\Search\Searcher:
+ Collaboration diagram for ILIAS\MetaData\Copyright\Search\Searcher:

Public Member Functions

 __construct (SearchFilterFactory $search_filter_factory, SearchClauseFactory $search_clause_factory, PathFactory $path_factory, CopyrightIdentifierHandler $copyright_identifier_handler,)
 
 search (LOMRepository $lom_repository, int $first_entry_id, int ... $further_entry_ids)
 
 withRestrictionToRepositoryObjects (bool $restricted)
 
 withAdditionalTypeFilter (string $type)
 
 search (LOMRepository $lom_repository, int $first_entry_id, int ... $further_entry_ids)
 
 withRestrictionToRepositoryObjects (bool $restricted)
 
 withAdditionalTypeFilter (string $type)
 

Protected Attributes

SearchFilterFactory $search_filter_factory
 
SearchClauseFactory $search_clause_factory
 
PathFactory $path_factory
 
CopyrightIdentifierHandler $copyright_identifier_handler
 
array $types = []
 
bool $restricted_to_repo_objects = false
 

Detailed Description

Definition at line 33 of file Searcher.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MetaData\Copyright\Search\Searcher::__construct ( SearchFilterFactory  $search_filter_factory,
SearchClauseFactory  $search_clause_factory,
PathFactory  $path_factory,
CopyrightIdentifierHandler  $copyright_identifier_handler 
)

Member Function Documentation

◆ search()

ILIAS\MetaData\Copyright\Search\Searcher::search ( LOMRepository  $lom_repository,
int  $first_entry_id,
int ...  $further_entry_ids 
)
Returns
RessourceIDInterface[]

Implements ILIAS\MetaData\Copyright\Search\SearcherInterface.

Definition at line 61 of file Searcher.php.

65 : \Generator {
66 $path_to_copyright = $this->path_factory->custom()
67 ->withNextStep('rights')
68 ->withNextStep('description')
69 ->withNextStep('string')
70 ->get();
71
72 $copyright_search_clauses = [];
73 foreach ([$first_entry_id, ...$further_entry_ids] as $entry_id) {
74 $copyright_search_clauses[] = $this->search_clause_factory->getBasicClause(
75 $path_to_copyright,
76 Mode::EQUALS,
77 $this->copyright_identifier_handler->buildIdentifierFromEntryID($entry_id)
78 );
79 }
80 $full_search_clause = $this->search_clause_factory->getJoinedClauses(
82 ...$copyright_search_clauses
83 );
84
85 $filters = [];
86 foreach ($this->types as $type) {
87 $filters[] = $this->search_filter_factory->get(
89 $this->restricted_to_repo_objects ? Placeholder::OBJ_ID : Placeholder::ANY,
90 $type
91 );
92 }
93 if (empty($filters) && $this->restricted_to_repo_objects) {
94 $filters[] = $this->search_filter_factory->get(
96 Placeholder::OBJ_ID,
98 );
99 }
100
101 yield from $lom_repository->searchMD($full_search_clause, null, null, ...$filters);
102 }

◆ withAdditionalTypeFilter()

ILIAS\MetaData\Copyright\Search\Searcher::withAdditionalTypeFilter ( string  $type)

Implements ILIAS\MetaData\Copyright\Search\SearcherInterface.

Definition at line 111 of file Searcher.php.

111 : SearcherInterface
112 {
113 $clone = clone $this;
114 $clone->types[] = $type;
115 return $clone;
116 }

◆ withRestrictionToRepositoryObjects()

ILIAS\MetaData\Copyright\Search\Searcher::withRestrictionToRepositoryObjects ( bool  $restricted)

Implements ILIAS\MetaData\Copyright\Search\SearcherInterface.

Definition at line 104 of file Searcher.php.

104 : SearcherInterface
105 {
106 $clone = clone $this;
107 $clone->restricted_to_repo_objects = $restricted;
108 return $clone;
109 }

Field Documentation

◆ $copyright_identifier_handler

CopyrightIdentifierHandler ILIAS\MetaData\Copyright\Search\Searcher::$copyright_identifier_handler
protected

Definition at line 38 of file Searcher.php.

Referenced by ILIAS\MetaData\Copyright\Search\Searcher\__construct().

◆ $path_factory

PathFactory ILIAS\MetaData\Copyright\Search\Searcher::$path_factory
protected

Definition at line 37 of file Searcher.php.

Referenced by ILIAS\MetaData\Copyright\Search\Searcher\__construct().

◆ $restricted_to_repo_objects

bool ILIAS\MetaData\Copyright\Search\Searcher::$restricted_to_repo_objects = false
protected

Definition at line 44 of file Searcher.php.

◆ $search_clause_factory

SearchClauseFactory ILIAS\MetaData\Copyright\Search\Searcher::$search_clause_factory
protected

Definition at line 36 of file Searcher.php.

Referenced by ILIAS\MetaData\Copyright\Search\Searcher\__construct().

◆ $search_filter_factory

SearchFilterFactory ILIAS\MetaData\Copyright\Search\Searcher::$search_filter_factory
protected

Definition at line 35 of file Searcher.php.

Referenced by ILIAS\MetaData\Copyright\Search\Searcher\__construct().

◆ $types

array ILIAS\MetaData\Copyright\Search\Searcher::$types = []
protected

Definition at line 43 of file Searcher.php.


The documentation for this class was generated from the following file: