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()

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

  • \GV\Entry[] — The entries as an array.

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

  • \GV\Entry_Collection — This collection, now hydrated.

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

  • \GV\Entry_Collection — A copy of the this collection with the filter applied.

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

  • \GV\Entry_Collection — A copy of the this collection with the sort applied.

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

  • \GV\Entry_Collection — A copy of the this collection with the limit applied.

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

  • \GV\Entry_Collection — A copy of the this collection with the offset applied.

See Also

  • \GV\Entry_Collection::page()

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

  • \GV\Entry_Collection — A copy of the this collection with the offset applied.

Source: src/Entry/EntryCollection.php:317

clear()

public function clear()

Source: src/Entry/EntryCollection.php:386