class Doctrine_Template_Listener_Sluggable extends Doctrine_Record_Listener (View source)

Easily create a slug for each record based on a specified set of fields

Properties

protected string $_options Array of sluggable options

Methods

setOption($name, $value = null)

setOption sets an option in order to allow flexible listener

getOptions()

getOptions returns all options of this template and the associated values

getOption($name)

getOption returns the value of given option

preSave(Doctrine_Event $event)

No description

postSave(Doctrine_Event $event)

No description

preDelete(Doctrine_Event $event)

No description

postDelete(Doctrine_Event $event)

No description

preUpdate(Doctrine_Event $event)

Set the slug value automatically when a record is updated if the options are configured to allow it

postUpdate(Doctrine_Event $event)

No description

preInsert(Doctrine_Event $event)

Set the slug value automatically when a record is inserted

postInsert(Doctrine_Event $event)

No description

preHydrate(Doctrine_Event $event)

No description

postHydrate(Doctrine_Event $event)

No description

preValidate(Doctrine_Event $event)

No description

void
__construct(array $options)

__construct

string
buildSlugFromFields(Doctrine_Record $record)

Generate the slug for a given Doctrine_Record based on the configured options

string
buildSlugFromSlugField(Doctrine_Record $record)

Generate the slug for a given Doctrine_Record slug field

string
getUniqueSlug(Doctrine_Record $record, string $slugFromFields)

Creates a unique slug for a given Doctrine_Record. This function enforces the uniqueness by incrementing the values with a postfix if the slug is not unique

Details

setOption($name, $value = null)

setOption sets an option in order to allow flexible listener

Parameters

$name
$value

getOptions()

getOptions returns all options of this template and the associated values

getOption($name)

getOption returns the value of given option

Parameters

$name

preSerialize(Doctrine_Event $event)

Parameters

Doctrine_Event $event

postSerialize(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preUnserialize(Doctrine_Event $event)

Parameters

Doctrine_Event $event

postUnserialize(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preDqlSelect(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preSave(Doctrine_Event $event)

Parameters

Doctrine_Event $event

postSave(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preDqlDelete(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preDelete(Doctrine_Event $event)

Parameters

Doctrine_Event $event

postDelete(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preDqlUpdate(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preUpdate(Doctrine_Event $event)

Set the slug value automatically when a record is updated if the options are configured to allow it

Parameters

Doctrine_Event $event

postUpdate(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preInsert(Doctrine_Event $event)

Set the slug value automatically when a record is inserted

Parameters

Doctrine_Event $event

postInsert(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preHydrate(Doctrine_Event $event)

Parameters

Doctrine_Event $event

postHydrate(Doctrine_Event $event)

Parameters

Doctrine_Event $event

preValidate(Doctrine_Event $event)

Parameters

Doctrine_Event $event

postValidate(Doctrine_Event $event)

Parameters

Doctrine_Event $event

void __construct(array $options)

__construct

Parameters

array $options

Return Value

void

protected string buildSlugFromFields(Doctrine_Record $record)

Generate the slug for a given Doctrine_Record based on the configured options

Parameters

Doctrine_Record $record

Return Value

string $slug

protected string buildSlugFromSlugField(Doctrine_Record $record)

Generate the slug for a given Doctrine_Record slug field

Parameters

Doctrine_Record $record

Return Value

string $slug

string getUniqueSlug(Doctrine_Record $record, string $slugFromFields)

Creates a unique slug for a given Doctrine_Record. This function enforces the uniqueness by incrementing the values with a postfix if the slug is not unique

Parameters

Doctrine_Record $record
string $slugFromFields

Return Value

string $slug