Skip to content

Instantly share code, notes, and snippets.

@lologhi
lologhi / EntityChoiceType.php
Last active October 26, 2015 01:42
Entity choicelist without bringing the whole entity (thx to @winzou)
<?php
namespace CommonBundle\Form;
use CommonBundle\Form\Transformer\EntityToIdTransformer;
use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectManager;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
@lologhi
lologhi / AmazonS3.php
Last active September 10, 2015 03:32 — forked from Remiii/AssetsUpdateStaticFilesCommand.php
Assetic + S3 = ❤️
<?php
namespace Bundle\Services;
use Aws\S3\S3Client;
class AmazonS3
{
protected $s3;
@lologhi
lologhi / Install elasticsearch on Ubuntu 14.04.md
Last active August 29, 2015 14:05
Install elasticsearch on Ubuntu 14.04

## Install Java

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

## Install elasticsearch

@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@lologhi
lologhi / Apply fixtures on Doctrine entities with ManyToMany relations.md
Last active April 29, 2017 14:25
Apply fixtures on Doctrine entities with ManyToMany relations

Club entity

/**
 * @ORM\ManyToMany(targetEntity="Field", inversedBy="clubs")
 */
private $fields;

Field entity