Skip to content

Instantly share code, notes, and snippets.

@adrienbrault
Created August 17, 2012 12:29
Show Gist options
  • Save adrienbrault/3378453 to your computer and use it in GitHub Desktop.
Save adrienbrault/3378453 to your computer and use it in GitHub Desktop.
<?php
$formView = $form->createView();
$renderedFormView = $formRenderer->searchAndRenderBlock($formView, 'rest'); // Object graph of FormRepresentation and InputRepresentation
$content = $this->get('serializer')->serialize($renderedFormView, $format);
<user>
<form xmlns="http://www.w3.org/1999/xhtml" method="GET" action="/app_dev.php/users">
<input type="integer" value="1" name="search[page]"/>
<input type="integer" value="20" name="search[limit]"/>
</form>
<user>
{
"forms" : [
{
"action" : "/app_dev.php/users",
"inputs" : [
{
"name" : "search[page]",
"type" : "integer",
"value" : "1"
},
{
"name" : "search[limit]",
"type" : "integer",
"value" : "20"
}
],
"method" : "GET",
"textareas" : [],
"xmlns" : "http://www.w3.org/1999/xhtml"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment