Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.

13. Virtual Field Descriptions

3.x version

13. Virtual Field Descriptions

Some fields including in the various Mappers don’t rely on any actual field in the Model (e.g., _action or batch).

In order to prevent any side-effects when trying to retrieve the value of this field (which doesn’t exist), the option virtual_field is specified for these fields.

When the template is instantiated, or whenever the value of the field is required, null will be returned without prying on the Model itself.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.