Back to course

Persisting Data

Symfony 0 to Hero: The Complete 2026 Guide

Saving to DB

In your controller:

php $product = new Product(); $product->setName('Keyboard');

$entityManager->persist($product); $entityManager->flush(); // This actually runs the SQL