Skip to content

make it possible to load multiple languages of a previously persisted document #556

@lsmith77

Description

@lsmith77
$user1 = new \Doctrine\Tests\Models\CMS\CmsUserTranslatable();
$user1->name = 'david';
$user1->username = 'dbu';
$user1->status = 'activ';
$this->dm->persist($user1);
$this->dm->bindTranslation($user1, 'en');
$user1->status = 'actif';
$this->dm->bindTranslation($user1, 'fr');

$this->dm->flush();
$this->assertEquals(0, $this->listener->count);
$this->dm->clear();

$user1 = $this->dm->findTranslation(null, $user1->id, 'en');
$this->dm->findTranslation(null, $user1->id, 'fr');

$this->dm->flush();

$this->assertEquals(0, $this->listener->count);

$user1 = $this->dm->findTranslation(null, $user1->id, 'en');
$user1->status = 'active';
$this->dm->loadTranslation($user1, 'fr'); // currently not possible

$this->dm->flush();

$this->assertEquals(1, $this->listener->count);
$this->dm->clear();

$user1 = $this->dm->findTranslation(null, $user1->id, 'en');
$this->assertEquals('active', $user1->status);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions