So, I have this Doctrine entity mapped on MySQL:
Dende\Calendar\Domain\Calendar:
> type: entity
> table: calendars
>
> embedded:
> id:
> class: Dende\Calendar\Domain\Calendar\CalendarId
> columnPrefix: false
>
> fields:
> name:
> type: string
> nullable: false
> length: 255
>
>
mapping definition of embedded class looks like this:
Dende\Calendar\Domain\Calendar\CalendarId:
type: embeddable
id:
id:
type: guid
generator: { strategy: UUID }
everything works almost smoothly except one thing. I use "Calendar" entity
in entity field type for symfony form. Field is added in form using form
builder like this:
$builder ->add("calendar", "entity", [ "class" =>
"Dende\Calendar\Domain\Calendar", "choice_label" => "name", "placeholder" =>
"Choose
calendar", ])
It's displayed ok when filling the form, but after submitting it I receive
en exception saying that:
[Syntax Error] line 0, col 106: Error: Expected
> Doctrine\ORM\Query\Lexer::T_CLOSE_PARENTHESIS, got '.'
>
As I found in stack trace, there's a query build with 'id.id' parameter
(which makes sense because Calendar->id() returns CalendarId and it also
has id() method) and that causes error (afterwards, when parsing):
ORMQueryBuilderLoader ->getEntitiesByIds ('id.id',
array('calendar_5629f2d738efc'))
>
>
Can anybody help me, what to do in this case? Is this some edge case of
doctrine or error in my mapping? Everything beside of this works fine.
I use Symfony 2.7 and Doctrine2.6
as far as I found, there could be a problem in generated query:
SELECT e FROM Dende\Calendar\Domain\Calendar e WHERE e.id.id
IN(:ORMQueryBuilderLoader_getEntitiesByIds_id.id)
>
>
and probably it's a matter of last dot bettween id and id above. When I run
this DQL query using app/console I get same error. After changing dot to
underscore, there's only too few parameters exception.
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.