GV\Entry_Collection
A collection of \GV\Entry objects.
Source: future/includes/class-gv-collection-entry.php:14
Details
- Kind:
class - Namespace:
GV - Extends:
Collection
Properties
| Property | Type | Description |
|---|---|---|
$filters | \GV\Entry_Filter[] | Filtering criteria. |
$sorts | \GV\Entry_Sort[] | Sorting criteria. |
$offset | int | The offset. |
$limit | int | The limit. |
$current_page | int | The current page. |
Methods
| Method | Description |
|---|---|
add() | Add an \GV\Entry to this collection. |
get() | Get a \GV\Entry from this list. |
total() | Count the total number of \GV\Entry objects that are possible to get. |
all() | Get the entries as an array. |
pluck() | Pluck by key. |
last() | Get the last \GV\Entry in this collection. |
first() | Get the first \GV\Entry in this collection. |
fetch() | Hydrate this collection now. |
filter() | Apply a filter to the current collection. |
sort() | Sort. |
limit() | Limit the fetch to a specified window. |
offset() | Add an $offset to these entries. |
page() | Set the current page. |
clear() | Clear this collection. |
Method Reference
add()
public function add( $entry )
Add an \GV\Entry to this collection.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | \GV\Entry | The entry to add to the internal array. |
Returns
void
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:66
get()
public function get( $entry_id, $backend='gravityforms' )
Get a \GV\Entry from this list.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | The ID of the entry to get. | |
$backend | string | 'gravityforms' | The form backend identifier, allows for multiple form backends in the future. Unused until then. |
Returns
- \GV\Entry |
null— The \GV\entry with the $entry_id as the ID, or null if not found.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:87
total()
public function total()
Count the total number of \GV\Entry objects that are possible to get.
Returns
int— The total number of entries that are fetchable.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:104
all()
public function all()
Get the entries as an array.
Returns
- \GV\Entry[] — The entries as an array.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:131
pluck()
public function pluck( $key )
Pluck by key.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$key | string | The key to pluck by. |
Returns
array— The plucked values.
Since: develop
Source: future/includes/class-gv-collection-entry.php:148
last()
public function last()
Get the last \GV\Entry in this collection.
Returns
- \GV\Entry |
null— The last entry or null.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:167
first()
public function first()
Get the first \GV\Entry in this collection.
Returns
- \GV\Entry |
null— The first entry or null.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:182
fetch()
public function fetch()
Hydrate this collection now.
Returns
- \GV\Entry_Collection — This collection, now hydrated.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:197
filter()
public function filter( \GV\Entry_Filter $filter )
Apply a filter to the current collection.
This operation is non-destructive as a copy of the collection is returned.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$filter | \GV\Entry_Filter | The filter to be applied. |
Returns
- \GV\Entry_Collection — A copy of the this collection with the filter applied.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:237
sort()
public function sort( $sort )
Sort.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$sort | \GV\Entry_Sort | The sort to apply to this collection. |
Returns
- \GV\Entry_Collection — A copy of the this collection with the sort applied.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:256
limit()
public function limit( $limit )
Limit the fetch to a specified window.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$limit | int | The limit. |
Returns
- \GV\Entry_Collection — A copy of the this collection with the limit applied.
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:275
offset()
public function offset( $offset )
Add an $offset to these entries.
Useful, you know, for pagination and stuff. Not too useful directly.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$offset | int | The number of entries to skip in the database. |
Returns
- \GV\Entry_Collection — A copy of the this collection with the offset applied.
See Also
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:296
page()
public function page( $page )
Set the current page.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$page | int | Set the current page to this page. Ends up agumenting the $offset in \GV\Entry_Offset |
Returns
- \GV\Entry_Collection — A copy of the this collection with the offset applied.
Source: future/includes/class-gv-collection-entry.php:310
clear()
public function clear()
Clear this collection.
Returns
void
Since: 2.0
Source: future/includes/class-gv-collection-entry.php:379