Symfony, mysql, fosuserbundle: Association Mapping - OneToOne

245
December 31, 2016, at 4:38 PM

I'm using FOSUserBundle.

So I have this USER and ADDRESS entities and are related one to one. I have the User created and I want to add an Address. In the EDIT PROFILE page I want to have a form where the User can add the Address.

Here comes the question: How can I make the Addres entity know that this new addres I'm creating is for the user that is now logged in?

Answer 1

No code at all doesn't help... We have no idea on how you display your form...

Why don't you just edit your user entity to hold user adress?

Either way, a wild guess would be like this in twig:

{{ render(controller('AppBundle:Entity:edit', { 'userId': user.id })) }}

Modify your controller editAction() to editAction($userId), and look at Form Events

READ ALSO
No Registration but no error too

No Registration but no error too

The Signup page is not registering the details and details are not being saved in table called members and also it's showing no error in the signup page post submit

202
MySQL Trigger From Previous Row

MySQL Trigger From Previous Row

Been working on this for hoursam so close

212
why can't get the router on node

why can't get the router on node

what can i do to solve this issue ? this my code :

199
Prepare Statement Fails to Insert Two out of Four Variables

Prepare Statement Fails to Insert Two out of Four Variables

I added two new fields to a tableThe SQL insert into continues to work for the two old fields, but fails to insert any data for the two new fields

213