Skip to content

Conversation

@mihai-stancu
Copy link
Contributor

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
Contributor 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
Contributor 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.

5 participants