diff --git a/lib/Doctrine/ORM/Id/AssignedGenerator.php b/lib/Doctrine/ORM/Id/AssignedGenerator.php index 63c6e5418..05c3790af 100644 --- a/lib/Doctrine/ORM/Id/AssignedGenerator.php +++ b/lib/Doctrine/ORM/Id/AssignedGenerator.php @@ -49,7 +49,7 @@ class AssignedGenerator extends AbstractIdGenerator foreach ($idFields as $idField) { $value = $class->reflFields[$idField]->getValue($entity); if (isset($value)) { - if (is_object($value)) { + if (isset($class->associationMappings[$idField])) { if (!$em->getUnitOfWork()->isInIdentityMap($value)) { throw ORMException::entityMissingForeignAssignedId($entity, $value); } @@ -67,7 +67,7 @@ class AssignedGenerator extends AbstractIdGenerator $idField = $class->identifier[0]; $value = $class->reflFields[$idField]->getValue($entity); if (isset($value)) { - if (is_object($value)) { + if (isset($class->associationMappings[$idField])) { if (!$em->getUnitOfWork()->isInIdentityMap($value)) { throw ORMException::entityMissingForeignAssignedId($entity, $value); } diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php index 8ff5e52a5..472978bc2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1209Test.php @@ -93,9 +93,9 @@ class DDC1209_2 public function __construct(DDC1209_1 $future1) { $this->future1 = $future1; - $this->starting_datetime = new \DateTime(); - $this->during_datetime = new \DateTime(); - $this->ending_datetime = new \DateTime(); + $this->starting_datetime = new DateTime2(); + $this->during_datetime = new DateTime2(); + $this->ending_datetime = new DateTime2(); } } @@ -120,6 +120,6 @@ class DateTime2 extends \DateTime { public function __toString() { - return $this->form('Y'); + return $this->format('Y'); } } \ No newline at end of file