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

Issues with Doctrine Embeddables #86

Closed
beezischillin opened this issue May 7, 2019 · 3 comments
Closed

Issues with Doctrine Embeddables #86

beezischillin opened this issue May 7, 2019 · 3 comments
Labels

Comments

@beezischillin
Copy link

beezischillin commented May 7, 2019

Hi peeps!

I've been having issue with getting Doctrine Embeddables to work with the DataTables.

If I have an entity that has its address fields in an Address class

    /**
     * @ORM\Embedded(class="App\Entity\Embedded\Address", columnPrefix="address_")
     * @Assert\Valid()
     */
    private $address;

With the address class simply containing fields that describe an address

/** @ORM\Embeddable() */
class Address
{
    /**
     * @ORM\Column(type="string", nullable=true)
     */
    private $address;
    /**
     * @ORM\Column(type="string", nullable=true)
     */
    private $street;
    /**
     * @ORM\Column(type="string", nullable=true)
     */
    private $city;
    /**
     * @ORM\Column(type="string", nullable=true)
     */
    private $state;
    /**
     * @ORM\Column(type="string", nullable=true)
     */
    private $zipCode;

I'm having difficulties using this in a Table. I've tried to use 'field' => 'address.city', which results in an exception:

Association name expected, 'address' is not an association.

Using 'propertyPath' => 'address.city' works insofar as it doesn't throw an error but using 'orderField' => 'address.city' in conjunction with this causes the following exception:

[Semantical Error] line 0, col 154 near 'address.city': Error: 'address' is not defined.

Thank you!

@curry684
Copy link
Member

curry684 commented Jul 4, 2019

Mmmmmm yes I'm pretty sure this can blow up in a lot of places, and will not be easy to fix. This'll need thorough investigation.

@curry684 curry684 added the bug label Jul 4, 2019
@curry684
Copy link
Member

curry684 commented Jul 4, 2019

@Clorr
Copy link

Clorr commented Oct 15, 2020

Hi, I used today an entity with embeddables, and I came to the same problem @beezischillin encountered. I fixed it the same way he did by using propertyPath instead of field. Maybe the main difference is I use FetchJoinORMAdapter.

For now, I'm not blocked, so it's mostly FYI. I would love to investigate on that, but I checked the code, and it's way above my skills on doctrine/symfony for now ;-)

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

3 participants