Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Documenting a couple methods

  • Loading branch information...
commit c602589e9cfd3088d1b951c19d227af76a502bd3 1 parent 0dced17
@lorenzo lorenzo authored
View
15 src/Model/Behavior/TranslateBehavior.php
@@ -339,6 +339,14 @@ protected function _groupTranslations($results) {
});
}
+/**
+ * Helper method used to generated multiple translated field entities
+ * out fo the data found in the `_translations` property in the passed
+ * entity. The result will be put into its `_i18n` property
+ *
+ * @param \Cake\ORM\Entity $entity
+ * @return void
+ */
protected function _bundleTranslatedFields($entity) {
$translations = (array)$entity->get('_translations');
@@ -384,6 +392,13 @@ protected function _bundleTranslatedFields($entity) {
$entity->set('_i18n', $contents);
}
+/**
+ * Returns the ids found for each of the condition arrays passed for the translations
+ * table. Each records is index by the corresponding position to the conditions array
+ *
+ * @param array $ruleSet an array of arary of conditions to be used for finding each
+ * @return array
+ */
protected function _findExistingTranslations($ruleSet) {
$association = $this->_table->association($this->config()['translationTable']);
$query = $association->find()
View
1  tests/TestCase/Model/Behavior/TranslateBehaviorTest.php
@@ -635,4 +635,5 @@ public function testSaveMultipleNewTranslations() {
$this->assertEquals('Titulo', $translations['spa']->get('title'));
$this->assertEquals('Titre', $translations['fre']->get('title'));
}
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.