Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DDC-3467] Embedded on private fields in an inheritance don't work correctly #1234

Open
wants to merge 1 commit into
base: old-prototype-3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/Doctrine/Tests/Models/DDC3467/DDC3467Planet.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably clean it up a little.

* Created by PhpStorm.
* User: marco
* Date: 30.12.14
* Time: 20:48
*/

namespace Doctrine\Tests\Models\DDC3467;


/**
* @Entity @Table @InheritanceType("SINGLE_TABLE")
* @DiscriminatorMap({"sun" = "DDC3467Sun"})
*/
abstract class DDC3467Planet {
/** @Id @Column(type="integer") */
private $id;
/** @Embedded(class="DDC3467Position") */
private $position;
/** @Column(type="string") */
private $name;
}
18 changes: 18 additions & 0 deletions tests/Doctrine/Tests/Models/DDC3467/DDC3467Position.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: marco
* Date: 30.12.14
* Time: 20:48
*/

namespace Doctrine\Tests\Models\DDC3467;


/** @Embeddable */
class DDC3467Position {
/** @Column(type="float") */
private $x;
/** @Column(type="float") */
private $y;
}
15 changes: 15 additions & 0 deletions tests/Doctrine/Tests/Models/DDC3467/DDC3467Sun.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* Created by PhpStorm.
* User: marco
* Date: 30.12.14
* Time: 20:48
*/

namespace Doctrine\Tests\Models\DDC3467;


/** @Entity */
class DDC3467Sun extends DDC3467Planet {

}
13 changes: 13 additions & 0 deletions tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@ public function testAcceptsEntityManagerInterfaceInstances()
// not really the cleanest way to check it, but we won't add a getter to the CMF just for the sake of testing.
$this->assertAttributeSame($entityManager, 'em', $classMetadataFactory);
}

/**
* @group DDC-3467
*/
public function testEmbeddableInSuperClass()
{
$em = $this->_getTestEntityManager();
$metadataFactory = $em->getMetadataFactory();
/** @var ClassMetadata $classMetadata */
$classMetadata = $metadataFactory->getMetadataFor('Doctrine\Tests\Models\DDC3467\DDC3467Sun');

// TODO somehow test that this did not fail?
}
}

/* Test subject class with overridden factory method for mocking purposes */
Expand Down