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

Embedded identifier support #16826

Closed
wants to merge 1 commit into from
Closed

Embedded identifier support #16826

wants to merge 1 commit into from

Conversation

mihai-stancu
Copy link

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets none
License MIT
Doc PR n/a

If you define your entity identifier using an embeddable class the identifier name will contain period symbols in it such as id.value which will generate a syntax error in the DQL lexer because parameter names are not allowed to contain period symbols.

Example to reproduce described bug:

/**
 * @ORM\Embeddable
 */
class Identifier {
    /**
     * @ORM\Column(type="integer")
     */
    protected $value;
}

/**
 * @ORM\Entity
 */
class Entity {
    /**
     * @ORM\Id @ORM\Embedded(class="Identifier")
     */
    protected $id;
}

@sstok
Copy link
Contributor

sstok commented Dec 8, 2015

Can you add a test to prevent future regressions?

Status: Needs work

@mihai-stancu
Copy link
Author

Sure, will come back with the test for this soon.

I just want to make sure there's no counter opinion relating to this (such as "why would you use embedded objects as entity identifiers").

@mihai-stancu
Copy link
Author

@sstok sorry for the delay, I added the suggested tests.

@fabpot
Copy link
Member

fabpot commented Dec 26, 2015

Thank you @mihai-stancu.

fabpot added a commit that referenced this pull request Dec 26, 2015
This PR was submitted for the 2.8 branch but it was merged into the 2.3 branch instead (closes #16826).

Discussion
----------

Embedded identifier support

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | none
| License       | MIT
| Doc PR        | n/a

If you define your entity identifier using an embeddable class the identifier name will contain period symbols in it such as `id.value` which will generate a syntax error in the DQL lexer because parameter names are not allowed to contain period symbols.

Example to reproduce described bug:

```php
/**
 * @Orm\Embeddable
 */
class Identifier {
    /**
     * @Orm\Column(type="integer")
     */
    protected $value;
}

/**
 * @Orm\Entity
 */
class Entity {
    /**
     * @Orm\Id @Orm\Embedded(class="Identifier")
     */
    protected $id;
}
```

Commits
-------

38fdda6 Embedded identifier support
@fabpot fabpot closed this Dec 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants