Download the PHP package samson/dataview-bundle without Composer
On this page you can find all versions of the php package samson/dataview-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download samson/dataview-bundle
More information about samson/dataview-bundle
Files in samson/dataview-bundle
Package dataview-bundle
Short Description Make configuring different serialization views for your entities easy and maintainable.
License MIT
Homepage https://github.com/SamsonIT/DataViewBundle
Informations about the package dataview-bundle
README
Example of use
If your object is a doctrine entity, you can let the guessers so the work for you:
By default, if a one-to-many or many-to-many collection is encountered, the type "collection" will be setup with
the option type
set to entity
. The entity type by default will try to convert your entity to an array with keys
id
and name
, the latter being the object cast to string.
Introduction
The DataViewBundle is based in great upon the Form component in symfony. It makes use of the FormView part to convert an object scheme into a basic array, making full use of the flexibility the Form component offers.
A problem often encountered, for example, is having a situation where you want to serialize a "Project" entity with all it's "Product" children in one controller, and a "Product" entity with it's "Product" parent in the other. In order to prevent an endless serialization loop, either make use of the options to tell each type what to include and what not, or simply add the relevant fields to the View from the controller.