Skip to content

Instantly share code, notes, and snippets.

<?php
namespace My\SomethingBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
@ricfrank
ricfrank / gist:4338691
Created December 19, 2012 17:46
Controller
/**
* Creates a new Banner entity.
*
* @Route("/create", name="admin_banner_create")
* @Method("post")
* @Template("MySomethingBundle:AdminBanner:index.html.twig")
*/
public function createAction()
{
$entity = new Banner();
@ricfrank
ricfrank / gist:4339396
Created December 19, 2012 18:59
Config
vich_uploader:
db_driver: orm
twig: true
gaufrette: false
storage: vich_uploader.storage.file_system
mappings:
banner_image:
uri_prefix: /uploads/banners
upload_destination: %kernel.root_dir%/../web/uploads/banners
/**
* @REST\Put("/services/trails/{id}/", name="find2ride_trails_put")
*/
public function editAction(Trail $trail) {
return $this->processForm($trail);
}
[
{
"trail_name": "Mario",
"text": "eksldksldksd",
"image_path": "oeoeoe.png",
"techniques": [],
"difficulty": "da matti",
"trail_url": "epwpewpe.it",
"ratings": 234,
"mid_rate": 234,
{
"trail_id": 2342,
"trail_name": "TOBOGA",
"bikepark_id": 342,
"bikepark_name": "Prato Selva Bikepark",
"place": {
},
"text": "",
"image_url": "",
#definizione servizi
#path/to/my_bundle/Resources/config/services.yml
services:
my_bundle.json_handler:
class: MyBundle\..\View\JsonViewHandler
my_bundle.view_handler:
parent: fos_rest.view_handler.default
calls:
public function linkCustomerAction($id)
{
$customer = $this->getDoctrine()->getRepository('PugMRestDemoBundle:Customer')->find($id);
$links = $this->getRequest()->attributes->get('links');
foreach($links as $invoice){
$customer->addInvoice($invoice);
}
$this->getDoctrine()->getManager()->flush();
}
{% block javascripts %}
{{ parent() }}
<!-- questo è quell che aggiungi nel singolo template con assetic-->
{% javascripts
'@SiparioMainBundle/Resources/public/js/NominativiDaAssegnareGrid.js' %}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
[
{
"trail_name": "Mario",
"text": "eksldksldksd",
"image_path": "oeoeoe.png",
"techniques": [],
"difficulty": "da matti",
"trail_url": "epwpewpe.it",
"ratings": 234,
"mid_rate": 234,