Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Documenting TranslateBehavior::beforeSave

  • Loading branch information...
commit 645fd490e30891d8373400dd61829a0968cbf974 1 parent 892a217
José Lorenzo Rodríguez lorenzo authored
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/Model/Behavior/TranslateBehavior.php
12 src/Model/Behavior/TranslateBehavior.php
View
@@ -14,6 +14,7 @@
*/
namespace Cake\Model\Behavior;
+use ArrayObject;
use Cake\Collection\Collection;
use Cake\Event\Event;
use Cake\ORM\Behavior;
@@ -148,7 +149,16 @@ public function beforeFind(Event $event, $query) {
}, $query::PREPEND);
}
- public function beforeSave(Event $event, $entity, $options) {
+/**
+ * Modifies the entity before it is saved so that translated fields are persisted
+ * in the database too.
+ *
+ * @param \Cake\Event\Event the beforeSave event that was fired
+ * @param \Cake\ORM\Entity the entity that is going to be saved
+ * @param \ArrayObject $options the options passed to the save method
+ * @return void
+ */
+ public function beforeSave(Event $event, Entity $entity, ArrayObject $options) {
$locale = $entity->get('_locale') ?: $this->locale();
if (!$locale) {
Please sign in to comment.
Something went wrong with that request. Please try again.