diff --git a/src/Model/Behavior/TranslateBehavior.php b/src/Model/Behavior/TranslateBehavior.php index 20ae68f..e7f74d5 100644 --- a/src/Model/Behavior/TranslateBehavior.php +++ b/src/Model/Behavior/TranslateBehavior.php @@ -19,6 +19,18 @@ public function __construct(Table $table, array $config = []) return parent::__construct($table, $config); } + /** + * initialize + */ + public function initialize(array $config) + { + parent::initialize($config); + $this->_translationTable->addBehavior('Croogo/Core.Trackable'); + } + + /** + * Delete translations + */ public function deleteTranslation(EntityInterface $entity, string $locale) { $runtimeModelAlias = $this->_translationTable->getAlias(); @@ -32,6 +44,9 @@ public function deleteTranslation(EntityInterface $entity, string $locale) return $this->_translationTable->deleteAll($deleteCond); } + /** + * When missing, populate _locale with default value + */ public function beforeMarshal(Event $event, ArrayObject $data, ArrayObject $options) { if (empty($data['_locale'])) {