2016-09-02 10:31:26 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Functional\Ticket;
|
|
|
|
|
|
|
|
use Doctrine\Tests\Models\Issue5989\Issue5989Employee;
|
|
|
|
use Doctrine\Tests\Models\Issue5989\Issue5989Manager;
|
|
|
|
use Doctrine\Tests\Models\Issue5989\Issue5989Person;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group issue-5989
|
|
|
|
*/
|
|
|
|
class Issue5989Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|
|
|
{
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->useModelSet('issue5989');
|
|
|
|
parent::setUp();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSimpleArrayTypeHydratedCorrectlyInJoinedInheritance()
|
|
|
|
{
|
|
|
|
$manager = new Issue5989Manager();
|
|
|
|
|
2016-09-08 11:48:34 +03:00
|
|
|
$managerTags = ['tag1', 'tag2'];
|
|
|
|
$manager->tags = $managerTags;
|
2016-09-02 10:31:26 +03:00
|
|
|
$this->_em->persist($manager);
|
|
|
|
|
|
|
|
$employee = new Issue5989Employee();
|
|
|
|
|
2016-09-08 11:48:34 +03:00
|
|
|
$employeeTags =['tag2', 'tag3'];
|
|
|
|
$employee->tags = $employeeTags;
|
2016-09-02 10:31:26 +03:00
|
|
|
$this->_em->persist($employee);
|
|
|
|
|
|
|
|
$this->_em->flush();
|
|
|
|
|
2016-09-08 11:48:34 +03:00
|
|
|
$managerId = $manager->id;
|
|
|
|
$employeeId = $employee->id;
|
2016-09-02 10:31:26 +03:00
|
|
|
|
|
|
|
// clear entity manager so that $repository->find actually fetches them and uses the hydrator
|
|
|
|
// instead of just returning the existing managed entities
|
|
|
|
$this->_em->clear();
|
|
|
|
|
2016-09-09 22:52:54 +02:00
|
|
|
$repository = $this->_em->getRepository(Issue5989Person::CLASSNAME);
|
2016-09-02 10:31:26 +03:00
|
|
|
|
|
|
|
$manager = $repository->find($managerId);
|
|
|
|
$employee = $repository->find($employeeId);
|
|
|
|
|
2016-09-08 11:48:34 +03:00
|
|
|
static::assertEquals($managerTags, $manager->tags);
|
|
|
|
static::assertEquals($employeeTags, $employee->tags);
|
2016-09-02 10:31:26 +03:00
|
|
|
}
|
|
|
|
}
|