Browse Source

Fixed some typos, CS errors and refactoring repetitive code

Jose Lorenzo Rodriguez 12 years ago
parent
commit
8db0595b68

+ 3 - 5
src/Model/Behavior/TranslateBehavior.php

@@ -164,7 +164,7 @@ class TranslateBehavior extends Behavior {
 	}
 
 /**
- * Custom finder method used to retrieve all translations for he found records.
+ * Custom finder method used to retrieve all translations for the found records.
  * Fetched translations can be filtered by locale by passing the `locales` key
  * in the options array.
  *
@@ -219,13 +219,11 @@ class TranslateBehavior extends Behavior {
 					continue;
 				}
 
-				$row->set([
-					$field => $translation->get('content'),
-					'_locale' => $locale
-				], $options);
+				$row->set($field, $translation->get('content'), $options);
 				unset($row[$name]);
 			}
 
+			$row->set('_locale', $locale, $options);
 			$row->clean();
 			return $row;
 		});

+ 6 - 0
src/ORM/Query.php

@@ -35,16 +35,22 @@ class Query extends DatabaseQuery {
 
 /**
  * Indicates that the operation should append to the list
+ *
+ * @var integer
  */
 	const APPEND = 0;
 
 /**
  * Indicates that the operation should prepend to the list
+ *
+ * @var integer
  */
 	const PREPEND = 1;
 
 /**
  * Indicates that the operation should overwrite the list
+ *
+ * @var boolean
  */
 	const OVERWRITE = true;
 

+ 0 - 1
tests/TestCase/Model/Behavior/TranslateBehaviorTest.php

@@ -43,7 +43,6 @@ class TranslateBehaviorTest extends TestCase {
 		TableRegistry::clear();
 	}
 
-
 /**
  * Returns an array with all the translations found for a set of records
  *