Persisting Entities
// get the entity manager that manages this entity $em = $this->getDoctrine()-> getManagerForClass(MyEntity::class); // create a new entity $entity = new MyEntity(); // populate / alter properties $entity->setName('Default Entity'); // tell Doctrine you want to (eventually) save $em->persist($entity); // actually executes the queries $em->flush(); |
Comments
Related