@@ 213-230 (lines=18) @@ | ||
210 | * @return bool|self[] True if material entities has been found and $return is passed |
|
211 | * or self[] if only two parameters is passed. |
|
212 | */ |
|
213 | public static function byNavigationIdAndFieldValue( |
|
214 | QueryInterface $query, |
|
215 | $navigationID, |
|
216 | $fieldID, |
|
217 | $fieldValue, |
|
218 | &$return = array() |
|
219 | ) { |
|
220 | /** @var array $materialIds Collection of entity identifiers filtered by additional field */ |
|
221 | $materialIds = null; |
|
222 | if (static::idsByNavigationID($query, $navigationID, $materialIds)) { |
|
223 | if (static::idsByFieldValue($query, $fieldID, $fieldValue, $materialIds, $materialIds)) { |
|
224 | static::byIDs($query, $materialIds, $return); |
|
225 | } |
|
226 | } |
|
227 | ||
228 | // If only one argument is passed - return null, otherwise bool |
|
229 | return func_num_args() > 4 ? sizeof($return) : $return; |
|
230 | } |
|
231 | ||
232 | /** |
|
233 | * Get current entity instances amount by navigation identifier and additional field value. |
|
@@ 243-260 (lines=18) @@ | ||
240 | * @return bool|self[] True if material entities has been found and $return is passed |
|
241 | * or self[] if only two parameters is passed. |
|
242 | */ |
|
243 | public static function amountByNavigationIdAndFieldValue( |
|
244 | QueryInterface $query, |
|
245 | $navigationID, |
|
246 | $fieldID, |
|
247 | $fieldValue, |
|
248 | &$return = array() |
|
249 | ) { |
|
250 | /** @var array $materialIds Collection of entity identifiers filtered by additional field */ |
|
251 | $materialIds = null; |
|
252 | if (static::idsByNavigationID($query, $navigationID, $materialIds)) { |
|
253 | if (static::idsByFieldValue($query, $fieldID, $fieldValue, $materialIds, $materialIds)) { |
|
254 | static::byIDs($query, $materialIds, $return, 'count'); |
|
255 | } |
|
256 | } |
|
257 | ||
258 | // If only one argument is passed - return null, otherwise bool |
|
259 | return func_num_args() > 4 ? sizeof($return) : $return; |
|
260 | } |
|
261 | ||
262 | /** |
|
263 | * Get material entity by URL(s). |