Search code examples
phpformssymfonysymfony4

Embedded form - Symfony 4


Is it possible to create nested form on Symfony 4 without using Entity (Database) ? I'm actually using API url to get my data. And all the tutorial on internet are using database so ... Thank you !


Solution

  • Yes, it's possible. You can follow tutorials all the way and omit the parts about mapping entities and using EntityManager in your controller. Everything else should remain the same. You should create a class representing an entity, use Symfony forms to handle form submissions and not persist your entities to the database using entity manager.

    Entity is just a class used to represent your data. It doesn't necessarily mean that a database is being used.