프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$_defaultConfig | array | These are merged with user-provided configuration when the behavior is used. | |
$_locale | string | The locale name that will be used to override fields in the bound table from the translations table | |
$_table | Table instance | ||
$_translationTable | Instance of Table responsible for translating |
메소드 | 설명 | |
---|---|---|
__construct ( |
Constructor | |
afterSave ( Cake\Event\Event $event, Cake\Datasource\EntityInterface $entity ) : void | Unsets the temporary _i18n property after the entity has been saved | |
beforeFind ( Cake\Event\Event $event, |
Callback method that listens to the beforeFind event in the bound table. It modifies the passed query by eager loading the translated fields and adding a formatter to copy the values into the main table records. | |
beforeSave ( Cake\Event\Event $event, Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : void | Modifies the entity before it is saved so that translated fields are persisted in the database too. | |
buildMarshalMap ( $marshaller, $map, $options ) | Add in _translations marshalling handlers if translation marshalling is enabled. You need to specifically enable translation marshalling by adding 'translations' => true to the options provided to Table::newEntity() or Table::patchEntity(). | |
findTranslations ( |
Custom finder method used to retrieve all translations for the found records. | |
groupTranslations ( Cake\Datasource\ResultSetInterface $results ) : Cake\Collection\Collection | Modifies the results from a table find in order to merge full translation records into each entity under the _translations key | |
initialize ( array $config ) : void | Initialize hook | |
locale ( string | null $locale = null ) : string | Sets all future finds for the bound table to also fetch translated fields for the passed locale. If no value is passed, it returns the currently configured locale | |
setupFieldAssociations ( array $fields, string $table, string $model, string $strategy ) : void | Creates the associations between the bound table and every field passed to this method. |
메소드 | 설명 | |
---|---|---|
_bundleTranslatedFields ( Cake\Datasource\EntityInterface $entity ) : void | Helper method used to generated multiple translated field entities out of the data found in the _translations property in the passed entity. The result will be put into its _i18n property | |
_findExistingTranslations ( array $ruleSet ) : array | Returns the ids found for each of the condition arrays passed for the translations table. Each records is indexed by the corresponding position to the conditions array | |
_referenceName ( |
Determine the reference name to use for a given table | |
_rowMapper ( Cake\Datasource\ResultSetInterface $results, string $locale ) : Cake\Collection\Collection | Modifies the results from a table find in order to merge the translated fields into each entity for a given locale. |
public __construct ( |
||
$table | The table this behavior is attached to. | |
$config | array | The config for this behavior. |
protected _bundleTranslatedFields ( Cake\Datasource\EntityInterface $entity ) : void | ||
$entity | Cake\Datasource\EntityInterface | Entity |
리턴 | void |
protected _findExistingTranslations ( array $ruleSet ) : array | ||
$ruleSet | array | an array of arary of conditions to be used for finding each |
리턴 | array |
protected _referenceName ( |
||
$table | The table class to get a reference name for. | |
리턴 | string |
protected _rowMapper ( Cake\Datasource\ResultSetInterface $results, string $locale ) : Cake\Collection\Collection | ||
$results | Cake\Datasource\ResultSetInterface | Results to map. |
$locale | string | Locale string |
리턴 | Cake\Collection\Collection |
public beforeFind ( Cake\Event\Event $event, |
||
$event | Cake\Event\Event | The beforeFind event that was fired. |
$query | Query | |
$options | ArrayObject | The options for the query |
리턴 | void |
public beforeSave ( Cake\Event\Event $event, Cake\Datasource\EntityInterface $entity, ArrayObject $options ) : void | ||
$event | Cake\Event\Event | The beforeSave event that was fired |
$entity | Cake\Datasource\EntityInterface | The entity that is going to be saved |
$options | ArrayObject | the options passed to the save method |
리턴 | void |
public findTranslations ( |
||
$query | The original query to modify | |
$options | array | Options |
리턴 |
public groupTranslations ( Cake\Datasource\ResultSetInterface $results ) : Cake\Collection\Collection | ||
$results | Cake\Datasource\ResultSetInterface | Results to modify. |
리턴 | Cake\Collection\Collection |
public initialize ( array $config ) : void | ||
$config | array | The config for this behavior. |
리턴 | void |
public setupFieldAssociations ( array $fields, string $table, string $model, string $strategy ) : void | ||
$fields | array | list of fields to create associations for |
$table | string | the table name to use for storing each field translation |
$model | string | the model field value |
$strategy | string | the strategy used in the _i18n association |
리턴 | void |
protected array $_defaultConfig | ||
리턴 | array |
protected string $_locale | ||
리턴 | string |