1
0
mirror of synced 2025-02-09 00:39:25 +03:00

#6613 #6614 correcting column mapping (was integer, should be string), segregating phone creation away

This commit is contained in:
Marco Pivetta 2017-08-11 14:41:32 +02:00
parent d7919678e5
commit b9ba4e3207
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -9,7 +9,6 @@
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\DBAL\Schema\SchemaException;
use Doctrine\ORM\PersistentCollection;
use Doctrine\Tests\OrmFunctionalTestCase;
@ -23,46 +22,43 @@ class DDC6613Test extends OrmFunctionalTestCase
{
parent::setUp();
try {
$this->setUpEntitySchema(
[
DDC6613Phone::class,
DDC6613User::class,
]
);
} catch (SchemaException $e) {
}
$this->setUpEntitySchema([
DDC6613Phone::class,
DDC6613User::class,
]);
}
public function testFail()
{
$newUser = new DDC6613User();
$this->_em->persist($newUser);
$this->_em->flush();
$this->_em->clear();
/** @var DDC6613User $user */
$user = $this->_em->find(DDC6613User::class, $newUser->id);
$phone1 = new DDC6613Phone();
$phone2 = new DDC6613Phone();
$this->_em->persist($phone1);
$this->_em->persist($phone2);
$this->_em->flush();
/* @var DDC6613User $user */
$user = $this->_em->find(DDC6613User::class, $newUser->id);
self::assertInstanceOf(DDC6613User::class, $user);
$phone1 = new DDC6613Phone();
$phones = $user->phones;
$user->phones->add($phone1);
$this->_em->persist($phone1);
$this->_em->flush();
$phone2 = new DDC6613Phone();
$user->phones->add($phone2);
$this->_em->persist($phone2);
/* @var $phones PersistentCollection */
// $phones = $user->phones;
$phones = $user->phones;
self::assertInstanceOf(PersistentCollection::class, $phones);
self::assertFalse($phones->isInitialized());
$phones->add($phone1);
$this->_em->flush();
$phones->add($phone2);
$phones->initialize();
self::assertTrue($phones->isInitialized());
@ -95,7 +91,7 @@ class DDC6613User
/** @Entity */
class DDC6613Phone
{
/** @Id @Column(type="integer") */
/** @Id @Column(type="string") */
private $id;
public function __construct()