public class EntryManager

class.entrymanager.php #19

The 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.

Properties

FieldManager $fieldManager

An instance of the FieldManager

TextFormatterManager $formatterManager

An instance of the TextFormatterManager

SectionManager $sectionManager

An instance of the SectionManager

Methods

array __buildEntries()

Given an array of Entry ID's and a section ID, return an array of Entry objects. For performance reasons, it's possible to pass an array of field names so that only a subset of the section will be queried. Do not pass this function ID values from across more than one section.

Parameters
  • $id_list An array of ID's

  • $section_id The section ID of the entries in the $id_list

  • $elementnames Choose whether to get data from a subset of fields or all fields in a section, by providing an array of field names. Defaults to null, which will load data from all fields in a section.

void __construct()

The constructor initialises the formatterManager, sectionManager and fieldManager variables and sets the $this->_Parent to the param provided.

Parameters
  • $parent The Administration object that this page has been created from passed by reference

boolean add()

Given an Entry object, iterate over all of the fields in that object an insert them into their relevant entry tables.

Parameters
  • $entry An Entry object to insert into the database

Entry create()

Creates a new Entry object using this class as the parent.

void delete()

Given an Entry object, or an array of Entry objects delete all data associated with this Entry using a Field's entryDataCleanup() function, and then remove this Entry from tbl_entries.

Parameters
  • $entries An Entry object, or an array of Entry objects to delete

boolean edit()

Update an existing Entry object given an Entry object

Parameters
  • $entry An Entry object

void fetch()

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
  • $entry_id An array of Entry ID's or an Entry ID to return

  • $section_id The ID of the Section that these entries are contained in

  • $limit The limit of entries to return

  • $start The starting offset of the entries to return

  • $where Any custom WHERE clauses

  • $joins Any custom JOIN's

  • $group Whether the entries need to be grouped by Entry ID or not

  • $records_only If this is set to true, an array of Entry objects will be returned without any basic pagination information. Defaults to false

  • $buildentries Whether to return an array of entry ID's or Entry objects. Defaults to true, which will return Entry objects

  • $elementnames Choose whether to get data from a subset of fields or all fields in a section, by providing an array of field names. Defaults to null, which will load data from all fields in a section.

array fetchByPage()

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
  • $page The page to return, defaults to 1

  • $section_id The ID of the Section that these entries are contained in

  • $entriesPerPage The number of entries to return per page.

  • $where Any custom WHERE clauses

  • $joins Any custom JOIN's

  • $group Whether the entries need to be grouped by Entry ID or not

  • $records_only If this is set to true, an array of Entry objects will be returned without any basic pagination information. Defaults to false

  • $buildentries Whether to return an array of entry ID's or Entry objects. Defaults to true, which will return Entry objects

  • $elementnames Choose whether to get data from a subset of fields or all fields in a section, by providing an array of field names. Defaults to null, which will load data from all fields in a section.

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

integer fetchCount()

Return the count of the number of entries in a particular section.

Parameters
  • $section_id The ID of the Section where the Entries are to be counted

  • $where Any custom WHERE clauses

  • $joins Any custom JOIN's

  • $group Whether the entries need to be grouped by Entry ID or not

integer fetchEntrySectionID()

Given an Entry ID, return the Section ID that it belongs to

Parameters
  • $entry_id The ID of the Entry to return it's section

Returns

The Section ID for this Entry's section

StdClass getFetchSorting()

Returns an object representation of the sorting for the EntryManager, with the field and direction provided

void setFetchSorting()

Convenience function that will set sorting field and direction by calling setFetchSortingField() & setFetchSortingDirection()

Parameters
  • $field_id The ID of the Field that should be sorted on

  • $direction The direction that entries should be sorted in, available options are RAND, ASC or DESC. Defaults to ASC

See Also
void setFetchSortingDirection()

Setter function for the default sorting direction of the Fetch function. Available options are RAND, ASC or DESC.

Parameters
  • $direction The direction that entries should be sorted in, available options are RAND, ASC or DESC.

void setFetchSortingField()

Sets the field to applying the sorting direction on when fetching entries

Parameters
  • $field_id The ID of the Field that should be sorted on

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details