Koowa_Database
[ class tree: Koowa_Database ] [ index: Koowa_Database ] [ all elements ]

Class: KDatabaseBehaviorSluggable

Source Location: /libraries/koowa/database/behavior/sluggable.php

Class Overview

KMixinAbstract
   |
   --KBehaviorAbstract
      |
      --KDatabaseBehaviorAbstract
         |
         --KDatabaseBehaviorSluggable

Database Sluggable Behavior


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: KDatabaseBehaviorAbstract

KDatabaseBehaviorAbstract::delete()
Deletes the row form the database.
KDatabaseBehaviorAbstract::execute()
Command handler
KDatabaseBehaviorAbstract::getMixableMethods()
Get the methods that are available for mixin based
KDatabaseBehaviorAbstract::save()
Saves the row or rowset in the database.

Class: KBehaviorAbstract

KBehaviorAbstract::__construct()
Constructor.
KBehaviorAbstract::execute()
Command handler
KBehaviorAbstract::getHandle()
Get an object handle
KBehaviorAbstract::getIdentifier()
Gets the service identifier.
KBehaviorAbstract::getMixableMethods()
Get the methods that are available for mixin based
KBehaviorAbstract::getPriority()
Get the priority of a behavior
KBehaviorAbstract::getService()
Get an instance of a class based on a class identifier only creating it if it doesn't exist yet.
KBehaviorAbstract::_initialize()
Initializes the options for the object

Class: KMixinAbstract

KMixinAbstract::__construct()
Object constructor
KMixinAbstract::getHandle()
Get a handle for this object
KMixinAbstract::getMethods()
Get a list of all the available methods
KMixinAbstract::getMixableMethods()
Get the methods that are available for mixin.
KMixinAbstract::getMixer()
Get the mixer object
KMixinAbstract::setMixer()
Set the mixer object
KMixinAbstract::_initialize()
Initializes the options for the object
KMixinAbstract::__call()
Search the mixin method map and call the method or trigger an error
KMixinAbstract::__get()
Overloaded get function
KMixinAbstract::__isset()
Overloaded isset function
KMixinAbstract::__set()
Overloaded set function
KMixinAbstract::__unset()
Overloaded isset function

Class Details

[line 17]
Database Sluggable Behavior



Tags:

author:  Johan Janssens <johan@nooku.org>


[ Top ]


Class Variables

$_columns =

[line 25]

The column name from where to generate the slug, or a set of column names to concatenate for generating the slug. Default is 'title'.



Tags:

access:  protected

Type:   array


[ Top ]

$_length =

[line 41]

Maximum length the generated slug can have. If this is null the length of the slug column will be used. Default is NULL.



Tags:

access:  protected

Type:   integer


[ Top ]

$_separator =

[line 33]

Separator character / string to use for replacing non alphabetic characters in generated slug. Default is '-'.



Tags:

access:  protected

Type:   string


[ Top ]

$_unique =

[line 58]

Set to true if slugs should be unique. If false and the slug column has a unique index set this will result in an error being throw that needs to be recovered. Default is NULL.



Tags:

access:  protected

Type:   boolean


[ Top ]

$_updatable =

[line 49]

Set to true if slugs should be re-generated when updating an existing row. Default is true.



Tags:

access:  protected

Type:   boolean


[ Top ]



Class Methods


constructor __construct [line 65]

KDatabaseBehaviorSluggable __construct( [ $config = null])

Constructor.



Tags:

access:  public


Overrides KBehaviorAbstract::__construct() (Constructor.)

Parameters:

object An   $config   optional KConfig object with configuration options

[ Top ]

method getMixableMethods [line 107]

array getMixableMethods( [ $mixer = null])

Get the methods that are available for mixin based

This function conditionally mixes the behavior. Only if the mixer has a 'slug' property the behavior will be mixed in.




Tags:

return:  An array of methods
access:  public


Overrides KDatabaseBehaviorAbstract::getMixableMethods() (Get the methods that are available for mixin based)

Parameters:

object The   $mixer   mixer requesting the mixable methods.

[ Top ]

method _afterTableInsert [line 128]

void _afterTableInsert( $context)

Insert a slug

If multiple columns are set they will be concatenated and separated by the separator in the order they are defined.

Requires a 'slug' column




Tags:

access:  protected


Parameters:

KCommandContext   $context  

[ Top ]

method _beforeTableUpdate [line 146]

void _beforeTableUpdate( $context)

Update the slug

Only works if $updatable property is TRUE. If the slug is empty the slug will be regenerated. If the slug has been modified it will be sanitized.

Requires a 'slug' column




Tags:

access:  protected


Parameters:

KCommandContext   $context  

[ Top ]

method _canonicalizeSlug [line 217]

void _canonicalizeSlug( )

Make sure the slug is unique

This function checks if the slug already exists and if so appends a number to the slug to make it unique. The slug will get the form of slug-x.




Tags:

access:  protected


[ Top ]

method _createFilter [line 158]

void _createFilter( )

Create a sluggable filter



Tags:

access:  protected


[ Top ]

method _createSlug [line 179]

boolean _createSlug( )

Create the slug



Tags:

return:  Return TRUE if the slug was created or updated successfully, otherwise FALSE.
access:  protected


[ Top ]

method _initialize [line 85]

void _initialize( $config)

Initializes the options for the object

Called from __construct() as a first step of object instantiation.




Tags:

access:  protected


Overrides KBehaviorAbstract::_initialize() (Initializes the options for the object)

Parameters:

object An   $config   optional KConfig object with configuration options

[ Top ]


Documentation generated on Fri, 24 May 2013 03:02:39 +0200 by phpDocumentor 1.4.3