#1336 DDC-3622 - removing implicit cast from string
to CustomIdObject
in entity API (confusing)
This commit is contained in:
parent
712b6a7a64
commit
5c89bb8c6b
@ -42,15 +42,11 @@ class CustomIdObjectTypeChild
|
||||
public $parent;
|
||||
|
||||
/**
|
||||
* @param CustomIdObject|string $id
|
||||
* @param CustomIdObject $id
|
||||
* @param CustomIdObjectTypeParent $parent
|
||||
*/
|
||||
public function __construct($id, CustomIdObjectTypeParent $parent)
|
||||
public function __construct(CustomIdObject $id, CustomIdObjectTypeParent $parent)
|
||||
{
|
||||
if (! $id instanceof CustomIdObject) {
|
||||
$id = new CustomIdObject($id);
|
||||
}
|
||||
|
||||
$this->id = $id;
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
@ -43,14 +43,10 @@ class CustomIdObjectTypeParent
|
||||
public $children;
|
||||
|
||||
/**
|
||||
* @param CustomIdObject|string $id
|
||||
* @param CustomIdObject $id
|
||||
*/
|
||||
public function __construct($id)
|
||||
public function __construct(CustomIdObject $id)
|
||||
{
|
||||
if (! $id instanceof CustomIdObject) {
|
||||
$id = new CustomIdObject($id);
|
||||
}
|
||||
|
||||
$this->id = $id;
|
||||
$this->children = new ArrayCollection();
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
use Doctrine\Tests\DbalTypes\CustomIdObject;
|
||||
use Doctrine\Tests\DbalTypes\CustomIdObjectType;
|
||||
use Doctrine\Tests\Models\CustomType\CustomIdObjectTypeChild;
|
||||
use Doctrine\Tests\Models\CustomType\CustomIdObjectTypeParent;
|
||||
@ -42,7 +43,7 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
|
||||
public function testFindByCustomIdObject()
|
||||
{
|
||||
$parent = new CustomIdObjectTypeParent('foo');
|
||||
$parent = new CustomIdObjectTypeParent(new CustomIdObject('foo'));
|
||||
|
||||
$this->_em->persist($parent);
|
||||
$this->_em->flush();
|
||||
@ -58,9 +59,9 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testFetchJoinCustomIdObject()
|
||||
{
|
||||
$parent = new CustomIdObjectTypeParent('foo');
|
||||
$parent = new CustomIdObjectTypeParent(new CustomIdObject('foo'));
|
||||
|
||||
$parent->children->add(new CustomIdObjectTypeChild('bar', $parent));
|
||||
$parent->children->add(new CustomIdObjectTypeChild(new CustomIdObject('bar'), $parent));
|
||||
|
||||
$this->_em->persist($parent);
|
||||
$this->_em->flush();
|
||||
@ -84,9 +85,9 @@ class CustomIdObjectTypeTest extends OrmFunctionalTestCase
|
||||
*/
|
||||
public function testFetchJoinWhereCustomIdObject()
|
||||
{
|
||||
$parent = new CustomIdObjectTypeParent('foo');
|
||||
$parent = new CustomIdObjectTypeParent(new CustomIdObject('foo'));
|
||||
|
||||
$parent->children->add(new CustomIdObjectTypeChild('bar', $parent));
|
||||
$parent->children->add(new CustomIdObjectTypeChild(new CustomIdObject('bar'), $parent));
|
||||
|
||||
$this->_em->persist($parent);
|
||||
$this->_em->flush();
|
||||
|
Loading…
Reference in New Issue
Block a user