I have a table USER, with an id
field configured like that :
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
I would want that the firstName
column by default would be "user12" when id=12, or "user1547" when id=1547 etc.
I know I can obtain the same result from different way (ex: in my "Entity" with the getFirstname
method, or, with a second command that update firstName value etc.) but it's not my point : I need that value in the database and it must be done on the same command that the one that "insert" my new user.
Do you think it's possible ?
I guess it's possible with currval
on PostgreSql with a command like :
INSERT INTO user (id, firstname, lastname) values (nextval('user_id_seq'), ('user' || currval('tmp_play_id_seq')::text), 'Smith');
But what about Doctrine ?