Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Empty translation entity fix.
  • Loading branch information
robertpustulka committed Jun 17, 2015
1 parent 40eeefc commit ec564bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/ORM/Behavior/Translate/TranslateTrait.php
Expand Up @@ -14,7 +14,7 @@
*/
namespace Cake\ORM\Behavior\Translate;

use Cake\ORM\Entity;
use Cake\Datasource\EntityInterface;

/**
* Contains a translation method aimed to help managing multiple translations
Expand Down Expand Up @@ -46,8 +46,10 @@ public function translation($language)
$created = true;
}

if ($created || empty($i18n[$language]) || !($i18n[$language] instanceof Entity)) {
$i18n[$language] = new Entity();
if ($created || empty($i18n[$language]) || !($i18n[$language] instanceof EntityInterface)) {
$className = get_class($this);

$i18n[$language] = new $className;
$created = true;
}

Expand Down

0 comments on commit ec564bf

Please sign in to comment.