TranslateBehavior Class Reference

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 37 of file translate.php.
Member Function Documentation
| TranslateBehavior::_getLocale | ( | &$ | model | ) |
Get selected locale for model
- Returns:
- mixed string or false
Definition at line 301 of file translate.php.
References I18n::getInstance(), and App::import().
Referenced by afterFind(), afterSave(), beforeFind(), and beforeValidate().
| TranslateBehavior::afterDelete | ( | &$ | model | ) |
Callback
Reimplemented from ModelBehavior.
Definition at line 291 of file translate.php.
References translateModel().
| TranslateBehavior::afterFind | ( | &$ | model, | |
| $ | results, | |||
| $ | primary | |||
| ) |
Callback
Reimplemented from ModelBehavior.
Definition at line 187 of file translate.php.
References _getLocale(), beforeFind(), and ife().
| TranslateBehavior::afterSave | ( | &$ | model, | |
| $ | created | |||
| ) |
Callback
Reimplemented from ModelBehavior.
Definition at line 252 of file translate.php.
References _getLocale(), ModelBehavior::beforeSave(), and translateModel().
| TranslateBehavior::beforeFind | ( | &$ | model, | |
| $ | query | |||
| ) |
Callback
Reimplemented from ModelBehavior.
Definition at line 78 of file translate.php.
References _getLocale(), ConnectionManager::getDataSource(), ife(), and translateModel().
Referenced by afterFind().
| TranslateBehavior::beforeValidate | ( | &$ | model | ) |
Callback
Reimplemented from ModelBehavior.
Definition at line 223 of file translate.php.
References _getLocale(), ModelBehavior::beforeSave(), and ife().
| 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 349 of file translate.php.
References translateModel().
Referenced by setup().
| TranslateBehavior::cleanup | ( | &$ | model | ) |
Callback
Reimplemented from ModelBehavior.
Definition at line 70 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
Reimplemented from ModelBehavior.
Definition at line 55 of file translate.php.
References $config, bindTranslation(), ConnectionManager::getDataSource(), and translateModel().
| & TranslateBehavior::translateModel | ( | &$ | model | ) |
Get instance of model for translations
- Returns:
- object
Definition at line 316 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 420 of file translate.php.
References translateModel().
Referenced by cleanup().
Member Data Documentation
| TranslateBehavior::$runtime = array() |
Used for runtime configuration of model
Definition at line 41 of file translate.php.
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/libs/model/behaviors/translate.php