set owner symfony

Solutions on MaxInterview for set owner symfony by the best coders in the world

showing results for - "set owner symfony"
Serena
10 Jan 2019
1use AppBundle\Entity\Post; //at top of controller
2
3$em = $this->getDoctrine()->getManager();
4$user = $this->container->get('security.token_storage')->getToken()->getUser();
5$post = new Post();
6$em->persist( $post );
7$post->setOwner( $user );
8// set other fields in your post entity
9$em->flush();
10
queries leading to this page
set owner symfonyset owner symfony