Re: [symfony-users] How to set a field with the id of the doctrine object in the saving process

2010-08-19 Thread Gustavo Adrian
I forgot to mention: The exception would be thrown if you attempt to insert (or update) a second object with an empty filename (having a nullable field you could insert as many objects as you want with NULL assigned to that field) On Thu, Aug 19, 2010 at 7:08 PM, Gustavo Adrian wrote: > If you h

Re: [symfony-users] How to set a field with the id of the doctrine object in the saving process

2010-08-19 Thread Gustavo Adrian
If you have unique = true and notnull = true then you have to assign a unique filename before you save the object, or you would have an exception. The better way would be to just assign a random name, as Georg says. If you really need the ID on the name, then first assign a random name and, after t

Re: [symfony-users] How to set a field with the id of the doctrine object in the saving process

2010-08-19 Thread Georg
Why don't you give it just a random name? Am 19.08.2010 21:55, schrieb Alexis Sanchez: > Hi! > > I have a doctrine model like this: > > Asset: > columns: > filename: { type: string(255), notnull: false, unique: true } > filesize: { type: integer, notnull: true } > > In the saving proc

Re: [symfony-users] How to set a field with the id of the doctrine object in the saving process

2010-08-19 Thread Rodrigo Ruiz
El 19/08/2010 15:55, Alexis Sanchez escribió: Hi! I have a doctrine model like this: Asset: columns: filename: { type: string(255), notnull: false, unique: true } filesize: { type: integer, notnull: true } In the saving process I want to check if the user has left the filename emp

[symfony-users] How to set a field with the id of the doctrine object in the saving process

2010-08-19 Thread Alexis Sanchez
Hi! I have a doctrine model like this: Asset: columns: filename: { type: string(255), notnull: false, unique: true } filesize: { type: integer, notnull: true } In the saving process I want to check if the user has left the filename empty. In that case i want to set the filename with th