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

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

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

doctrinebot opened this issue Sep 10, 2014 · 2 comments
Assignees
Labels
Milestone

Comments

@doctrinebot
Copy link

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
Copy link
Author

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
Copy link

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
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 doctrine#4097 and doctrine#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 added a commit that referenced this issue Jun 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants