Skip to main content

GV\Entry_Collection

A collection of \GV\Entry objects.

Source: stubs/gravityview.php:4779

Details​

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: stubs/gravityview.php:4825

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: stubs/gravityview.php:4839

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: stubs/gravityview.php:4850

all()​

public function all()

Get the entries as an array.

Returns​

Since: 2.0

Source: stubs/gravityview.php:4861

pluck()​

public function pluck( $key )

Pluck by key.

Parameters​

NameTypeDefaultDescription
$keystringThe key to pluck by.

Returns​

  • array — The plucked values.

Since: 2.0.10

Source: stubs/gravityview.php:4874

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: stubs/gravityview.php:4885

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: stubs/gravityview.php:4896

fetch()​

public function fetch()

Hydrate this collection now.

Returns​

Since: 2.0

Source: stubs/gravityview.php:4907

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: stubs/gravityview.php:4922

sort()​

public function sort( $sort )

Sort.

Parameters​

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

Returns​

Since: 2.0

Source: stubs/gravityview.php:4935

limit()​

public function limit( $limit )

Limit the fetch to a specified window.

Parameters​

NameTypeDefaultDescription
$limitintThe limit.

Returns​

Since: 2.0

Source: stubs/gravityview.php:4948

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: stubs/gravityview.php:4965

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: stubs/gravityview.php:4975

clear()​

public function clear()

Clear this collection.

Returns​

  • void

Since: 2.0

Source: stubs/gravityview.php:5033