Skip to main content

GravityKit\GravityView\Entry\EntryCollection

A collection of \GV\Entry objects.

Since:

  • 2.0
  • 3.0.0 (Migrated to GravityKit\GravityView\Entry namespace.)

Source: src/Entry/EntryCollection.php:21

Details​

  • Kind: class
  • Namespace: GravityKit\GravityView\Entry
  • Extends: GV\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: src/Entry/EntryCollection.php:73

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: src/Entry/EntryCollection.php:94

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: src/Entry/EntryCollection.php:111

all()​

public function all()

Get the entries as an array.

Returns​

Since: 2.0

Source: src/Entry/EntryCollection.php:138

pluck()​

public function pluck( $key )

Pluck by key.

Parameters​

NameTypeDefaultDescription
$keystringThe key to pluck by.

Returns​

  • array — The plucked values.

Since: 3.0.0

Source: src/Entry/EntryCollection.php:155

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: src/Entry/EntryCollection.php:174

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: src/Entry/EntryCollection.php:189

fetch()​

public function fetch()

Hydrate this collection now.

Returns​

Since: 2.0

Source: src/Entry/EntryCollection.php:204

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: src/Entry/EntryCollection.php:244

sort()​

public function sort( $sort )

Sort.

Parameters​

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

Returns​

Since: 2.0

Source: src/Entry/EntryCollection.php:263

limit()​

public function limit( $limit )

Limit the fetch to a specified window.

Parameters​

NameTypeDefaultDescription
$limitintThe limit.

Returns​

Since: 2.0

Source: src/Entry/EntryCollection.php:282

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: src/Entry/EntryCollection.php:303

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: src/Entry/EntryCollection.php:317

clear()​

public function clear()

Clear this collection.

Returns​

  • void

Since: 2.0

Source: src/Entry/EntryCollection.php:386