public class Entry

class.entry.php #13

An entry is a combination of data that is stored in several Fields typically contained in one Section. Entries are created by the Authors of Symphony and hold all the content for the website. Entries are typically created from the Symphony backend, but can also be created using Events from the Frontend.

Properties

string $creationDate

An ISO 8601 representation of when this Entry was created eg. 2004-02-12T15:19:21+00:00

Methods

void __construct(mixed $parent)

Construct a new instance of an Entry.

Parameters
  • $parent mixedThe class that created this Entry object, usually the EntryManager, passed by reference.

integer assignEntryId()

Creates the initial entry row in tbl_entries and returns the resulting Entry ID using getInsertID().

See Also
integer checkPostData(array $data, mixed $errors, boolean $ignore_missing_fields, array $error)

Given a array of data from a form, this function will iterate over all the fields in this Entry's Section and call their checkPostFieldData() function.

Parameters
  • $data arrayAn associative array of the data for this entry where they key is the Field's handle for this Section and the value is the data from the form

  • $error arrayAn array of errors, by reference. Defaults to empty

  • $ignore_missing_fields booleanThis parameter allows Entries to be updated, rather than replaced. This is useful if the input form only contains a couple of the fields for this Entry. Defaults to false, which will check all Fields even if they are not provided in the $data

Returns

Either __ENTRY_OK__ or __ENTRY_FIELD_ERROR__

boolean commit()

Commits this Entry's data to the database, by utilising the EntryManager's add/edit functions. The commit function first finds all the default data for this before calling it's Manager

Returns

true if the commit was successful, false otherwise.

See Also
array fetchAllAssociatedEntryCounts(array $associated_sections)

Entries may link to other Entries through fields. This function will return the number of entries that are associated with the current entry as an associative array. If there are no associated entries, null will be returned.

Parameters
  • $associated_sections arrayAn associative array of sections to return the Entry counts from. Defaults to null, which will fetch all the associations of this Entry.

Returns

An associative array with the key being the associated Section's ID and the value being the number of entries associated with this Entry.

void findDefaultData()

Iterates over all the Fields in this Entry calling their processRawFieldData() function to set default values for this Entry.

See Also
null|mixed|array get(string $setting)

Accessor to the a setting by name. If no setting is provided all the settings of this Entry instance are returned.

Parameters
  • $setting string(optional) the name of the setting to access the value for. This is optional and defaults to null in which case all settings are returned.

Returns

the value of the setting if there is one, all settings if the input setting was omitted or null if the setting was supplied but there is no value for that setting.

array|object getData(integer $field_id, boolean $asObject)

Accessor function to return data from this Entry for a particular field. Optional parameter to return this data as an object instead of an array. If a Field is not provided, an associative array of all data assigned to this Entry will be returned.

Parameters
  • $field_id integerThe ID of the Field whose data you want

  • $asObject booleanIf true, the data will be returned as an object instead of an array. Defaults to false. Note that if a $field_id is not provided the result will always be an array.

Returns

Depending on the value of $asObject, return the field's data as either an array or an object

void set(string $setting, mixed $value)

Entries have some basic metadata settings such as the Entry ID, the Author ID who created it and the Section that the Entry sits in. This function will set a setting to a value overwriting any existing value for this setting

Parameters
  • $setting stringthe setting key.

  • $value mixedthe value of the setting.

void setData(integer $field_id, mixed $data)

Set the data for a Field in this Entry, given the Field ID and it's data

Parameters
  • $field_id integerThe ID of the Field this data is for

  • $data mixedOften an array

integer setDataFromPost(array $data, array $error, boolean $simulate, boolean $ignore_missing_fields)

When an entry is saved from a form (either Frontend/Backend) this function will find all the fields in this set and loop over them, setting the data to each of the fields for processing. If any errors occur during this, _ENTRY_FIELD_ERROR_ is returned, and an array is available with the errors.

Parameters
  • $data arrayAn associative array of the data for this entry where they key is the Field's handle for this Section and the value is the data from the form

  • $error arrayAn array of errors, by reference. Defaults to empty

  • $simulate booleanIf $simulate is given as true, a dry run of this function will occur, where regardless of errors, an Entry will not be saved in the database. Defaults to false

  • $ignore_missing_fields booleanThis parameter allows Entries to be updated, rather than replaced. This is useful if the input form only contains a couple of the fields for this Entry. Defaults to false, which will set Fields to their default values if they are not provided in the $data

Returns

Either __ENTRY_OK__ or __ENTRY_FIELD_ERROR__

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