Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Test for DDC2106 #582

Closed
wants to merge 1 commit into from

3 participants

@frosas

No description provided.

@doctrinebot
Collaborator

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DDC-2299

@guilhermeblanco

Fixed in 2.4 according to http://www.doctrine-project.org/jira/browse/DDC-2106
Closing related PR here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 16, 2013
  1. @frosas

    Test for DDC2106

    frosas authored
This page is out of date. Refresh to see the latest.
Showing with 65 additions and 0 deletions.
  1. +65 −0 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php
View
65 tests/Doctrine/Tests/ORM/Functional/Ticket/DDC2106Test.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace Doctrine\Tests\ORM\Functional\Ticket;
+
+require_once __DIR__ . '/../../../TestInit.php';
+
+use Doctrine\Tests\Models\Generic\DateTimeModel;
+use Doctrine\Common\Collections\Criteria;
+
+/**
+ * @group DDC-2106
+ */
+class DDC2106Test extends \Doctrine\Tests\OrmFunctionalTestCase
+{
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->_schemaTool->createSchema(array(
+ $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC2106Entity'),
+ ));
+ }
+
+ public function test()
+ {
+ // We want an uninitialized PersistentCollection $entity->children
+ $entity = new DDC2106Entity();
+ $this->_em->persist($entity);
+ $this->_em->flush();
+ $this->_em->detach($entity);
+ $entity = $this->_em->getRepository(__NAMESPACE__ . '\DDC2106Entity')->findOneBy(array());
+
+ // ... and a managed entity without id
+ $entityWithoutId = new DDC2106Entity();
+ $this->_em->persist($entityWithoutId);
+
+ $criteria = Criteria::create()->where(Criteria::expr()->eq('parent', $entityWithoutId));
+ $entity->children->matching($criteria)->first();
+ }
+}
+
+/**
+ * @Entity
+ */
+class DDC2106Entity
+{
+ /**
+ * @Id
+ * @GeneratedValue(strategy="IDENTITY")
+ * @Column(type="integer")
+ */
+ public $id;
+
+ /** @ManyToOne(targetEntity="DDC2106Entity", inversedBy="children") */
+ public $parent;
+
+ /**
+ * @OneToMany(targetEntity="DDC2106Entity", mappedBy="parent", cascade={"persist"})
+ */
+ public $children;
+
+ public function __construct()
+ {
+ $this->children = new \Doctrine\Common\Collections\ArrayCollection;
+ }
+}
Something went wrong with that request. Please try again.