- Symphony 2.7.0
-
› assets
14 -
› boot
15 -
› core
24 -
› cryptography
4 -
› data-sources
6 -
› email-gateways
3 -
› events
3 -
› global
61 -
› interface
9 -
› toolkit
60 - Delegates101
- Deprecated28
Versions
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.3
- 2.7.2
- 2.7.10
- 2.7.1
- 2.7.0
- 2.6.9
- 2.6.8
- 2.6.7
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.3
- 2.6.2
- 2.6.11
- 2.6.10
- 2.6.1
- 2.6.0
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4
- 2.3.6
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
Options
public class EntryManager
class.entrymanager.php #15The EntryManager
is responsible for all Entry
objects in Symphony.
Entries are stored in the database in a cluster of tables. There is a
parent entry row stored in tbl_entries
and then each field's data is
stored in a separate table, tbl_entries_data_{field_id}
. Where Field ID
is generated when the Section is saved. This Manager provides basic
add, edit, delete and fetching methods for Entries.
Methods
static array __buildEntries(
$rows, $section_id, $element_names)
Given an array of Entry data from tbl_entries
and a section ID, return an
array of Entry objects. For performance reasons, it's possible to pass an array
of field handles via $element_names
, so that only a subset of the section schema
will be queried. This function currently only supports Entry from one section at a
time.
Parameters
Returns
An array of Entry objects
static boolean add(Entry $entry)
Given an Entry object, iterate over all of the fields in that object an insert them into their relevant entry tables.
Parameters
See Also
static Entry create()
Creates a new Entry object using this class as the parent.
static boolean delete(
$entries, $section_id)
Given an Entry ID, or an array of Entry ID's, delete all
data associated with this Entry using a Field's entryDataCleanup()
function, and then remove this Entry from tbl_entries
. If the $entries
all belong to the same section, passing $section_id
will improve
performance
Parameters
static boolean edit(Entry $entry)
Update an existing Entry object given an Entry object
Parameters
See Also
static array fetch(
$entry_id, $section_id, $limit, $start, $where, $joins, $group, $buildentries, $element_names, $enable_sort)
This function will return an array of Entry objects given an ID or an array of ID's.
Do not provide $entry_id
as an array if not specifying the $section_id
. This function
is commonly passed custom SQL statements through the $where
and $join
parameters
that is generated by the fields of this section.
Parameters
Returns
If $buildentries
is true, this function will return an array of Entry objects, otherwise it will return an associative array of Entry data from tbl_entries
static array fetchByPage(
$page, $section_id, $entriesPerPage, $where, $joins, $group, $records_only, $buildentries, $element_names)
Returns an array of Entry objects, with some basic pagination given the number of Entry's to return and the current starting offset. This function in turn calls the fetch function that does alot of the heavy lifting. For instance, if there are 60 entries in a section and the pagination dictates that per page, 15 entries are to be returned, by passing 2 to the $page parameter you could return entries 15-30
Parameters
Returns
Either an array of Entry objects, or an associative array containing the total entries, the start position, the entries per page and the Entry objects
static integer fetchCount(
$section_id, $where, $joins, $group)
Return the count of the number of entries in a particular section.
Parameters
static integer fetchEntrySectionID(
$entry_id)
Given an Entry ID, return the Section ID that it belongs to
Parameters
Returns
The Section ID for this Entry's section
static StdClass getFetchSorting()
Returns an object representation of the sorting for the EntryManager, with the field and direction provided
static void setFetchSorting(
$field_id, $direction)
Convenience function that will set sorting field and direction
by calling setFetchSortingField()
& setFetchSortingDirection()
Parameters
See Also
static void setFetchSortingDirection(
$direction)
Setter function for the default sorting direction of the Fetch function. Available options are RAND, ASC or DESC.
Parameters
static void setFetchSortingField(
$field_id)
Sets the field to applying the sorting direction on when fetching entries