An apparently simple HTML component, for example text with an image, already has a quite a few variants: The text or the image might be optional. There might be a view where the image is extra wide compared to the text, or the text takes up the most part of the component. Combine those and you easily get four variants for one component, and that doesn't even include more elaborate configurations.
If you try to accommodate all the variants in one view, you end up with a mess of conditional statements to select the right CSS classes. A lesson learned is to keep the amount of conditionals (cyclomatic complexity) of a view as low as possible. The code that determines the view, for example a Controller or ViewComponent should select the view based on the configuration of the component.
The above still doesn't require a mapping layer. All the views can be bound to the database entity and there is still no risk of exposing too much data.
If you try to accommodate all the variants in one view, you end up with a mess of conditional statements to select the right CSS classes. A lesson learned is to keep the amount of conditionals (cyclomatic complexity) of a view as low as possible. The code that determines the view, for example a Controller or ViewComponent should select the view based on the configuration of the component.
The above still doesn't require a mapping layer. All the views can be bound to the database entity and there is still no risk of exposing too much data.