Skip to main content

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

PropertyTypeDescription
$filters\GV\Entry_Filter[]Filtering criteria.
$sorts\GV\Entry_Sort[]Sorting criteria.
$offsetintThe offset.
$limitintThe limit.
$current_pageintThe current page.

Methods

MethodDescription
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

NameTypeDefaultDescription
$entry\GV\EntryThe 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

NameTypeDefaultDescription
$entry_idintThe ID of the entry to get.
$backendstring'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

Since: 2.0

Source: future/includes/class-gv-collection-entry.php:131

pluck()

public function pluck( $key )

Pluck by key.

Parameters

NameTypeDefaultDescription
$keystringThe 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

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

NameTypeDefaultDescription
$filter\GV\Entry_FilterThe filter to be applied.

Returns

Since: 2.0

Source: future/includes/class-gv-collection-entry.php:237

sort()

public function sort( $sort )

Sort.

Parameters

NameTypeDefaultDescription
$sort\GV\Entry_SortThe sort to apply to this collection.

Returns

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

NameTypeDefaultDescription
$limitintThe limit.

Returns

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

NameTypeDefaultDescription
$offsetintThe number of entries to skip in the database.

Returns

See Also

Since: 2.0

Source: future/includes/class-gv-collection-entry.php:296

page()

public function page( $page )

Set the current page.

Parameters

NameTypeDefaultDescription
$pageintSet the current page to this page. Ends up agumenting the $offset in \GV\Entry_Offset

Returns

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