@@ 110-123 (lines=14) @@ | ||
107 | * @return bool|self[] True if material entities has been found and $return is passed |
|
108 | * or self[] if only two parameters is passed. |
|
109 | */ |
|
110 | public static function byFieldValue(QueryInterface $query, $fieldID, $fieldValue, &$return = array()) |
|
111 | { |
|
112 | /** @var array $materialIds Collection of entity identifiers filtered by additional field */ |
|
113 | $materialIds = null; |
|
114 | if (static::idsByFieldValue($query, $fieldID, $fieldValue, $materialIds)) { |
|
115 | // Get material instances |
|
116 | $return = $query->entity(get_called_class()) |
|
117 | ->where('MaterialID', $materialIds) |
|
118 | ->exec(); |
|
119 | } |
|
120 | ||
121 | // If only one argument is passed - return null, otherwise bool |
|
122 | return func_num_args() > 3 ? $return == null : $return; |
|
123 | } |
|
124 | ||
125 | /** |
|
126 | * Get current entity instances collection by navigation identifier. |
|
@@ 150-163 (lines=14) @@ | ||
147 | return func_num_args() > 2 ? $return == null : $return; |
|
148 | } |
|
149 | ||
150 | public static function byNavigationIdAndFieldValue(QueryInterface $query, $navigationID, $fieldID, $fieldValue, &$return = array()) |
|
151 | { |
|
152 | /** @var array $materialIds Collection of entity identifiers filtered by additional field */ |
|
153 | $materialIds = null; |
|
154 | if (static::idsByNavigationID($query, $navigationID, $materialIds)) { |
|
155 | ||
156 | $return = $query->entity(get_called_class()) |
|
157 | ->where('MaterialID', $materialIds) |
|
158 | ->exec(); |
|
159 | } |
|
160 | ||
161 | // If only one argument is passed - return null, otherwise bool |
|
162 | return func_num_args() > 3 ? $return == null : $return; |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * Get material entities collection by URL(s). |