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-3303: @ORM\Embedded does not work with extending classes #4097

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

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

This comment has been minimized.

Show comment
Hide comment
@doctrinebot

doctrinebot Oct 1, 2015

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

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

@martinopic

This comment has been minimized.

Show comment
Hide comment
@martinopic

martinopic May 1, 2016

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

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

lcobucci added a commit to lcobucci/doctrine2 that referenced this issue Jun 9, 2016

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.

@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