Set the primary key of a new entity manually

1 view
Skip to first unread message

Rico Leuthold

unread,
Feb 17, 2011, 5:56:22 AM2/17/11
to flextrine
Hi,

I tried to set the primary key of a new entity manually - meaning I
did not set the id property in the php class to
"@GeneratedValue(strategy="IDENTITY")" but tried to set it in as code
using "entity.id = 33".

When I try to persists this entity through the EntityManager i get an
error saying: "Error: Behaviour of persist for detached entities is
not yet defined".

Does this mean, that the id of an entity can not be set manually
(maybe possible in version 0.9?), or am I missing something?

Many thanks again

- rico

Dave Keen

unread,
Feb 17, 2011, 6:01:53 AM2/17/11
to flex...@googlegroups.com
Hey Rico,

That won't work as at present as Flextrine uses the existence of an id as a way to determine whether an entity has been saved or not (hence EntityManager's confusion).  Its not something I've needed so far so this feature probably won't be in 0.9, but it will certainly be something for the future.

Dave
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.872 / Virus Database: 271.1.1/3448 - Release Date: 02/16/11 20:34:00

Rico Leuthold

unread,
Feb 17, 2011, 6:13:22 AM2/17/11
to flextrine
Hi Dave,

Thank you again for your quick reply.

I definitely vote for such a feature ;-)

Have a good day.
- rico
Reply all
Reply to author
Forward
0 new messages