ILIAS  trunk Revision v12.0_alpha-1541-g23eaa5e013d
ILIAS\News\Data\NewsCriteria Class Reference

News Criteria DTO for querying news items supports caching, JSON serialization, and validation. More...

+ Inheritance diagram for ILIAS\News\Data\NewsCriteria:
+ Collaboration diagram for ILIAS\News\Data\NewsCriteria:

Public Member Functions

 getPeriod ()
 
 isOnlyPublic ()
 
 getMinPriority ()
 
 getMaxPriority ()
 
 getLimit ()
 
 isPreventNesting ()
 
 isNoAutoGenerated ()
 
 getExcludedNewsIds ()
 
 isIncludeReadStatus ()
 
 getReadUserId ()
 
 getStartDates ()
 
 withPeriod (?int $period)
 
 withOnlyPublic (bool $only_public)
 
 withMinPriority (?int $min_priority)
 
 withMaxPriority (?int $max_priority)
 
 withLimit (?int $limit)
 
 withPreventNesting (bool $stop_nesting)
 
 withNoAutoGenerated (bool $no_auto_generated)
 
 withExcludedNewsIds (array $excluded_news_ids)
 
 withIncludeReadStatus (bool $include_read_status)
 
 withReadUserId (?int $read_user_id)
 
 withStartDates (array $start_dates)
 
 jsonSerialize ()
 
 toArray ()
 
 hasPriorityFilters ()
 Check if criteria has priority filters. More...
 
 validate ()
 Validate criteria parameters. More...
 

Detailed Description

News Criteria DTO for querying news items supports caching, JSON serialization, and validation.

Definition at line 28 of file NewsCriteria.php.

Member Function Documentation

◆ getExcludedNewsIds()

ILIAS\News\Data\NewsCriteria::getExcludedNewsIds ( )

Definition at line 87 of file NewsCriteria.php.

87 : array
88 {
89 return $this->excluded_news_ids;
90 }

Referenced by ILIAS\News\Domain\NewsCollectionService\applyFinalProcessing().

+ Here is the caller graph for this function:

◆ getLimit()

ILIAS\News\Data\NewsCriteria::getLimit ( )

Definition at line 72 of file NewsCriteria.php.

72 : ?int
73 {
74 return $this->limit;
75 }

Referenced by ILIAS\News\Domain\NewsCollectionService\applyFinalProcessing().

+ Here is the caller graph for this function:

◆ getMaxPriority()

ILIAS\News\Data\NewsCriteria::getMaxPriority ( )

Definition at line 67 of file NewsCriteria.php.

67 : ?int
68 {
69 return $this->max_priority;
70 }

Referenced by ILIAS\News\Persistence\NewsRepository\buildBatchQuery(), and ILIAS\News\Persistence\NewsCache\generateL3Key().

+ Here is the caller graph for this function:

◆ getMinPriority()

ILIAS\News\Data\NewsCriteria::getMinPriority ( )

Definition at line 62 of file NewsCriteria.php.

62 : ?int
63 {
64 return $this->min_priority;
65 }

Referenced by ILIAS\News\Persistence\NewsRepository\buildBatchQuery(), and ILIAS\News\Persistence\NewsCache\generateL3Key().

+ Here is the caller graph for this function:

◆ getPeriod()

ILIAS\News\Data\NewsCriteria::getPeriod ( )

Definition at line 52 of file NewsCriteria.php.

52 : ?int
53 {
54 return $this->period;
55 }

Referenced by ILIAS\News\Persistence\NewsRepository\buildBatchQuery(), ILIAS\News\Persistence\NewsRepository\filterContext(), and ILIAS\News\Persistence\NewsCache\generateL3Key().

+ Here is the caller graph for this function:

◆ getReadUserId()

ILIAS\News\Data\NewsCriteria::getReadUserId ( )

◆ getStartDates()

ILIAS\News\Data\NewsCriteria::getStartDates ( )
Returns
array<int, DateTimeImmutable>

Definition at line 105 of file NewsCriteria.php.

105 : array
106 {
107 return $this->start_dates;
108 }

Referenced by ILIAS\News\Persistence\NewsRepository\buildBatchQuery(), ILIAS\News\Persistence\NewsRepository\filterContext(), and ILIAS\News\Persistence\NewsCache\generateL3Key().

+ Here is the caller graph for this function:

◆ hasPriorityFilters()

ILIAS\News\Data\NewsCriteria::hasPriorityFilters ( )

Check if criteria has priority filters.

Definition at line 219 of file NewsCriteria.php.

219 : bool
220 {
221 return $this->min_priority !== null || $this->max_priority !== null;
222 }

◆ isIncludeReadStatus()

ILIAS\News\Data\NewsCriteria::isIncludeReadStatus ( )

Definition at line 92 of file NewsCriteria.php.

92 : bool
93 {
94 return $this->include_read_status ?? false;
95 }

Referenced by ILIAS\News\Persistence\NewsRepository\buildBatchQuery(), ILIAS\News\Persistence\NewsRepository\findByContextsBatch(), ILIAS\News\Persistence\NewsRepository\findByContextsBatchLazy(), and ILIAS\News\Domain\NewsCollectionService\getNewsForUser().

+ Here is the caller graph for this function:

◆ isNoAutoGenerated()

ILIAS\News\Data\NewsCriteria::isNoAutoGenerated ( )

Definition at line 82 of file NewsCriteria.php.

82 : bool
83 {
84 return $this->no_auto_generated;
85 }

Referenced by ILIAS\News\Persistence\NewsRepository\buildBatchQuery(), and ILIAS\News\Persistence\NewsCache\generateL3Key().

+ Here is the caller graph for this function:

◆ isOnlyPublic()

◆ isPreventNesting()

ILIAS\News\Data\NewsCriteria::isPreventNesting ( )

Definition at line 77 of file NewsCriteria.php.

77 : bool
78 {
79 return $this->prevent_nesting;
80 }

Referenced by ILIAS\News\Domain\NewsCollectionService\getNewsForContexts().

+ Here is the caller graph for this function:

◆ jsonSerialize()

ILIAS\News\Data\NewsCriteria::jsonSerialize ( )

Definition at line 194 of file NewsCriteria.php.

194 : array
195 {
196 return $this->toArray();
197 }

References ILIAS\News\Data\NewsCriteria\toArray().

+ Here is the call graph for this function:

◆ toArray()

ILIAS\News\Data\NewsCriteria::toArray ( )

Definition at line 199 of file NewsCriteria.php.

199 : array
200 {
201 return [
202 'period' => $this->period,
203 'only_public' => $this->only_public,
204 'min_priority' => $this->min_priority,
205 'max_priority' => $this->max_priority,
206 'limit' => $this->limit,
207 'stop_nesting' => $this->prevent_nesting,
208 'no_auto_generated' => $this->no_auto_generated,
209 'excluded_news_ids' => $this->excluded_news_ids,
210 'include_read_status' => $this->include_read_status,
211 'read_user_id' => $this->read_user_id,
212 'start_dates' => $this->start_dates
213 ];
214 }

Referenced by ILIAS\News\Data\NewsCriteria\jsonSerialize().

+ Here is the caller graph for this function:

◆ validate()

ILIAS\News\Data\NewsCriteria::validate ( )

Validate criteria parameters.

Definition at line 227 of file NewsCriteria.php.

227 : void
228 {
229 if ($this->min_priority !== null && $this->max_priority !== null && $this->min_priority > $this->max_priority) {
230 throw new \InvalidArgumentException('Min priority cannot be greater than max priority');
231 }
232
233 if ($this->limit !== null && $this->limit < 0) {
234 throw new \InvalidArgumentException('Limit cannot be negative');
235 }
236 }

Referenced by ILIAS\News\Domain\NewsCollectionService\getNewsForUser().

+ Here is the caller graph for this function:

◆ withExcludedNewsIds()

ILIAS\News\Data\NewsCriteria::withExcludedNewsIds ( array  $excluded_news_ids)

Definition at line 159 of file NewsCriteria.php.

159 : self
160 {
161 $new = clone $this;
162 $new->excluded_news_ids = array_map('intval', $excluded_news_ids);
163 return $new;
164 }

◆ withIncludeReadStatus()

ILIAS\News\Data\NewsCriteria::withIncludeReadStatus ( bool  $include_read_status)

Definition at line 166 of file NewsCriteria.php.

166 : self
167 {
168 $new = clone $this;
169 $new->include_read_status = $include_read_status;
170 return $new;
171 }

◆ withLimit()

ILIAS\News\Data\NewsCriteria::withLimit ( ?int  $limit)

Definition at line 138 of file NewsCriteria.php.

138 : self
139 {
140 $new = clone $this;
141 $new->limit = $limit;
142 return $new;
143 }

◆ withMaxPriority()

ILIAS\News\Data\NewsCriteria::withMaxPriority ( ?int  $max_priority)

Definition at line 131 of file NewsCriteria.php.

131 : self
132 {
133 $new = clone $this;
134 $new->max_priority = $max_priority;
135 return $new;
136 }

◆ withMinPriority()

ILIAS\News\Data\NewsCriteria::withMinPriority ( ?int  $min_priority)

Definition at line 124 of file NewsCriteria.php.

124 : self
125 {
126 $new = clone $this;
127 $new->min_priority = $min_priority;
128 return $new;
129 }

◆ withNoAutoGenerated()

ILIAS\News\Data\NewsCriteria::withNoAutoGenerated ( bool  $no_auto_generated)

Definition at line 152 of file NewsCriteria.php.

152 : self
153 {
154 $new = clone $this;
155 $new->no_auto_generated = $no_auto_generated;
156 return $new;
157 }

◆ withOnlyPublic()

ILIAS\News\Data\NewsCriteria::withOnlyPublic ( bool  $only_public)

Definition at line 117 of file NewsCriteria.php.

117 : self
118 {
119 $new = clone $this;
120 $new->only_public = $only_public;
121 return $new;
122 }

◆ withPeriod()

ILIAS\News\Data\NewsCriteria::withPeriod ( ?int  $period)

Definition at line 110 of file NewsCriteria.php.

110 : self
111 {
112 $new = clone $this;
113 $new->period = $period;
114 return $new;
115 }

◆ withPreventNesting()

ILIAS\News\Data\NewsCriteria::withPreventNesting ( bool  $stop_nesting)

Definition at line 145 of file NewsCriteria.php.

145 : self
146 {
147 $new = clone $this;
148 $new->prevent_nesting = $stop_nesting;
149 return $new;
150 }

◆ withReadUserId()

ILIAS\News\Data\NewsCriteria::withReadUserId ( ?int  $read_user_id)

Definition at line 173 of file NewsCriteria.php.

173 : self
174 {
175 $new = clone $this;
176 $new->read_user_id = $read_user_id;
177 return $new;
178 }

Referenced by ILIAS\News\Domain\NewsCollectionService\getNewsForUser().

+ Here is the caller graph for this function:

◆ withStartDates()

ILIAS\News\Data\NewsCriteria::withStartDates ( array  $start_dates)
Parameters
array<int,DateTimeImmutable>$start_dates

Definition at line 183 of file NewsCriteria.php.

183 : self
184 {
185 $new = clone $this;
186 $new->start_dates = $start_dates;
187 return $new;
188 }

Referenced by ILIAS\News\Domain\NewsCollectionService\appendStartDateFilter().

+ Here is the caller graph for this function:

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