DDC-3303: @ORM\Embedded does not work with extending classes #4097

Closed
doctrinebot opened this Issue Sep 10, 2014 · 2 comments

Projects

None yet

4 participants

@doctrinebot

Jira issue originally created by user TheBelgarion:

I update my symfony 2.5 with ORM 2.5. to try out the Embedded function.
I currently does not work correctly with extending class

/****
 * @ORM\Entity
 * @ORM\Table(name="A", uniqueConstraints={@UniqueConstraint(name="id", columns={"id"})})
 */
class A extends B {}
abstract class Item {

    /****
     * @var $bonus
     * @ORM\Embedded(class="Bonus")
     *
     */
    private $bonus;
}

it only works if i put the definition of the Embedded properties directly in class A ( but it works with all normal properties defined in the Abstract )

@doctrinebot

Comment created by jpi:

Hi, I confirm this bug.
Im using Symfony 2.7.5 DBAL 2.5.2 ORM 2.5.1.

Error : Property xxx::$description does not exist

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@martinopic

Setting the parent class properties to "protected" (instead of private") works and could be an acceptable workaround for some.

@lcobucci lcobucci added a commit to lcobucci/doctrine2 that referenced this issue Jun 9, 2016
@lcobucci lcobucci Allow the usage of embedded objects on parent classes.
The `ClassMetadataInfo` was always using the "current class" to
fetch the reflection of a property even when a field is declared
on the parent class (which causes `ReflectionProperty` to throw
an exception).

Fixes #4097 and #4277.
1e8e42c
@Ocramius Ocramius added this to the 2.5.5 milestone Jun 19, 2016
@Ocramius Ocramius assigned Ocramius and unassigned beberlei Jun 19, 2016
@Ocramius Ocramius closed this in 3dfc180 Jun 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment