Wow! This actually works! Thank you!
This is great for DDD approach, when you have entity identity as a separate 
class!
So e.g. I have a User which is identified by UserID but stored in a single 
database table.

On Thursday, January 28, 2016 at 1:55:44 PM UTC+3, Bartosz Bartniczak wrote:
>
> Thank you for your response Marco.
> I did some research and I have found some workaround. I just added 
> autoincrement option and it works. Thank you alot, your tip was really 
> helpful.
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <doctrine-mapping 
> xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping";
>                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>                   
> xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
>         http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd";>
>
>     <embeddable name="AppBundle\Entity\User\UserId">
>
>         <id name="value" column="id" type="integer">
>             <options>
>                 <option name="autoincrement">true</option>
>             </options>
>         </id>
>     </embeddable>
> </doctrine-mapping>
>
>
> W dniu środa, 27 stycznia 2016 20:17:52 UTC+1 użytkownik Marco Pivetta 
> napisał:
>>
>> We don't officially support embeddables as identifiers at the moment. 
>> They may work, but I'd try the annotation or XML drivers first, and write 
>> tests for that (if it works). No guarantees/batteries included, sorry!
>>
>> Marco Pivetta 
>>
>> http://twitter.com/Ocramius      
>>
>> http://ocramius.github.com/
>>
>> On 27 January 2016 at 18:18, Bartosz Bartniczak <[email protected]> 
>> wrote:
>>
>>> Is there any way to set Embeddable as Entity ID?
>>>
>>> The code below works almost fine, but id column does not have 
>>> AUTO_INCREMENT property set.
>>>
>>> AppBundle\Entity\User\User:
>>>   type: entity
>>>   table: users
>>>   embedded:
>>>     id:
>>>       class: AppBundle\Entity\User\UserId
>>>       columnPrefix: false
>>>   fields:
>>>     firstName:
>>>       type: string
>>>       length: 100
>>>     lastName:
>>>       type: string
>>>       length: 100
>>>
>>>
>>> AppBundle\Entity\User\UserId:
>>>   type: embeddable
>>>   id:
>>>     value:
>>>       column: id
>>>       type: integer
>>>       generator:
>>>         strategy: IDENTITY
>>>
>>>
>>> I use Postgres database, and Doctrine-ORM 2.5
>>> Is there any solution for this problem?
>>>
>>> -- 
>>> 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 https://groups.google.com/group/doctrine-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
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 https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to