EntryRevisions

Type
Class
Namespace
craft\services
Inherits
craft\services\EntryRevisions » yii\base\Component » yii\base\BaseObject
Implements
yii\base\Configurable
Since
3.0
Deprecated in
in 3.2

Entry Revisions service.

An instance of the Entry Revisions service is globally accessible in Craft via Craft::$app->entryRevisions.

View source

Public Properties

PropertyDescription
behaviorsyii\base\Behavior – List of behaviors attached to this component

Public Methods

MethodDescription
__call()Calls the named method which is not a class method.
__clone()This method is called after the object is created by cloning an existing one.
__construct()Constructor.
__get()Returns the value of an object property.
__isset()Checks if a property is set, i.e. defined and not null.
__set()Sets value of an object property.
__unset()Sets an object property to null.
attachBehavior()Attaches a behavior to this component.
attachBehaviors()Attaches a list of behaviors to the component.
behaviors()Returns a list of behaviors that this component should behave as.
canGetProperty()Returns a value indicating whether a property can be read.
canSetProperty()Returns a value indicating whether a property can be set.
className()Returns the fully qualified name of this class.
detachBehavior()Detaches a behavior from the component.
detachBehaviors()Detaches all behaviors from the component.
doesEntryHaveVersions()Returns whether an entry has any versions stored.
ensureBehaviors()Makes sure that the behaviors declared in behaviors() are attached to this component.
getBehavior()Returns the named behavior object.
getBehaviors()Returns all behaviors attached to this component.
getDraftById()Returns a draft by its ID.
getDraftsByEntryId()Returns drafts of a given entry.
getEditableDraftsByEntryId()Returns the drafts of a given entry that are editable by the current user.
getVersionById()Returns a version by its ID.
getVersionsByEntryId()Returns versions by an entry ID.
hasEventHandlers()Returns a value indicating whether there is any handler attached to the named event.
hasMethod()Returns a value indicating whether a method is defined.
hasProperty()Returns a value indicating whether a property is defined.
init()Initializes the object.
off()Detaches an existing event handler from this component.
on()Attaches an event handler to an event.
trigger()Triggers an event.

doesEntryHaveVersions()

DEPRECATED

Deprecated in 3.2. Use an entry query instead.

Returns whether an entry has any versions stored.

View source

Arguments

  • $entryId (integer) – The entry ID to search for
  • $siteId (integer, null) – The site ID to search for

Returns

boolean

getDraftById()

DEPRECATED

Deprecated in 3.2. Use an entry query instead.

Returns a draft by its ID.

View source

Arguments

Returns

craft\elements\Entry, null

getDraftsByEntryId()

DEPRECATED

Deprecated in 3.2. Use an entry query instead.

Returns drafts of a given entry.

View source

Arguments

  • $entryId (integer)
  • $siteId (integer, null)
  • $withContent (boolean) – Whether the field content should be included on the drafts

Returns

craft\elements\Entry[]

getEditableDraftsByEntryId()

DEPRECATED

Deprecated in 3.2. Use craft\services\Drafts::getEditableDrafts() instead.

Returns the drafts of a given entry that are editable by the current user.

View source

Arguments

Returns

craft\elements\Entry[]

Throws

getVersionById()

DEPRECATED

Deprecated in 3.2. Use an entry query instead.

Returns a version by its ID.

View source

Arguments

Returns

craft\elements\Entry, null

getVersionsByEntryId()

DEPRECATED

Deprecated in 3.2. Use an entry query instead.

Returns versions by an entry ID.

View source

Arguments

  • $entryId (integer) – The entry ID to search for.
  • $siteId (integer, null) – The site ID to search for.
  • $limit (integer, null) – The limit on the number of versions to retrieve.
  • $includeCurrent (boolean) – Whether to include the current "top" version of the entry.
  • $withContent (boolean) – Whether the field content should be included on the versions

Returns

craft\elements\Entry[]

Events

EVENT_AFTER_DELETE_DRAFT

DEPRECATED

Deprecated in 3.2

Type
\craft\services\DraftEvent

The event that is triggered after a draft is deleted.

EVENT_AFTER_PUBLISH_DRAFT

DEPRECATED

Deprecated in 3.2

Type
\craft\services\DraftEvent

The event that is triggered after a draft is published.

EVENT_AFTER_REVERT_ENTRY_TO_VERSION

DEPRECATED

Deprecated in 3.2

Type
\craft\services\VersionEvent

The event that is triggered after an entry is reverted to an old version.

EVENT_AFTER_SAVE_DRAFT

DEPRECATED

Deprecated in 3.2

Type
\craft\services\DraftEvent

The event that is triggered after a draft is saved.

EVENT_BEFORE_DELETE_DRAFT

DEPRECATED

Deprecated in 3.2

Type
\craft\services\DraftEvent

The event that is triggered before a draft is deleted.

EVENT_BEFORE_PUBLISH_DRAFT

DEPRECATED

Deprecated in 3.2

Type
\craft\services\DraftEvent

The event that is triggered before a draft is published.

EVENT_BEFORE_REVERT_ENTRY_TO_VERSION

DEPRECATED

Deprecated in 3.2

Type
\craft\services\VersionEvent

The event that is triggered before an entry is reverted to an old version.

EVENT_BEFORE_SAVE_DRAFT

DEPRECATED

Deprecated in 3.2

Type
\craft\services\DraftEvent

The event that is triggered before a draft is saved.