TranslateBehavior Class Reference

Inheritance diagram for TranslateBehavior:

ModelBehavior Object List of all members.

Public Member Functions

 _getLocale (&$model)
 afterDelete (&$model)
 afterFind (&$model, $results, $primary)
 afterSave (&$model, $created)
 beforeFind (&$model, $query)
 beforeValidate (&$model)
 bindTranslation (&$model, $fields, $reset=true)
 cleanup (&$model)
 setup (&$model, $config=array())
translateModel (&$model)
 unbindTranslation (&$model, $fields=null)

Public Attributes

 $runtime = array()

Detailed Description

Definition at line 35 of file translate.php.


Member Function Documentation

TranslateBehavior::_getLocale ( &$  model  ) 

Get selected locale for model

Returns:
mixed string or false protected

Definition at line 339 of file translate.php.

References I18n::getInstance(), App::import(), and Configure::read().

Referenced by afterFind(), afterSave(), beforeFind(), and beforeValidate().

TranslateBehavior::afterDelete ( &$  model  ) 

afterDelete Callback

Returns:
void public

Reimplemented from ModelBehavior.

Definition at line 328 of file translate.php.

References translateModel().

TranslateBehavior::afterFind ( &$  model,
results,
primary 
)

afterFind Callback

Parameters:
array $results
boolean $primary
Returns:
array Modified results public

Reimplemented from ModelBehavior.

Definition at line 211 of file translate.php.

References __(), _getLocale(), and beforeFind().

TranslateBehavior::afterSave ( &$  model,
created 
)

afterSave Callback

Parameters:
boolean $created
Returns:
void public

Reimplemented from ModelBehavior.

Definition at line 286 of file translate.php.

References _getLocale(), ModelBehavior::beforeSave(), and translateModel().

TranslateBehavior::beforeFind ( &$  model,
query 
)

beforeFind Callback

Parameters:
array $query
Returns:
array Modified query public

Reimplemented from ModelBehavior.

Definition at line 90 of file translate.php.

References __(), _getLocale(), ConnectionManager::getDataSource(), name(), and translateModel().

Referenced by afterFind().

TranslateBehavior::beforeValidate ( &$  model  ) 

beforeValidate Callback

Returns:
boolean public

Reimplemented from ModelBehavior.

Definition at line 253 of file translate.php.

References _getLocale(), and ModelBehavior::beforeSave().

TranslateBehavior::bindTranslation ( &$  model,
fields,
reset = true 
)

Bind translation for fields, optionally with hasMany association for fake field

Parameters:
object instance of model
mixed string with field or array(field1, field2=>AssocName, field3)
boolean $reset
Returns:
bool

Definition at line 387 of file translate.php.

References __(), and translateModel().

Referenced by setup().

TranslateBehavior::cleanup ( &$  model  ) 

Callback

Returns:
void public

Reimplemented from ModelBehavior.

Definition at line 78 of file translate.php.

References unbindTranslation().

TranslateBehavior::setup ( &$  model,
config = array() 
)

Callback

$config for TranslateBehavior should be array( 'fields' => array('field_one', 'field_two' => 'FieldAssoc', 'field_three'))

With above example only one permanent hasMany will be joined (for field_two as FieldAssoc)

$config could be empty - and translations configured dynamically by bindTranslation() method

Parameters:
array $config
Returns:
mixed public

Reimplemented from ModelBehavior.

Definition at line 57 of file translate.php.

References $config, __(), bindTranslation(), ConnectionManager::getDataSource(), and translateModel().

& TranslateBehavior::translateModel ( &$  model  ) 

Get instance of model for translations

Returns:
object public

Definition at line 357 of file translate.php.

References ClassRegistry::init().

Referenced by afterDelete(), afterSave(), beforeFind(), bindTranslation(), setup(), and unbindTranslation().

TranslateBehavior::unbindTranslation ( &$  model,
fields = null 
)

Unbind translation for fields, optionally unbinds hasMany association for fake field

Parameters:
object instance of model
mixed string with field, or array(field1, field2=>AssocName, field3), or null for unbind all original translations
Returns:
bool

Definition at line 458 of file translate.php.

References translateModel().

Referenced by cleanup().


Member Data Documentation

TranslateBehavior::$runtime = array()

Used for runtime configuration of model

Definition at line 39 of file translate.php.


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:57 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7