Skip to content

Instantly share code, notes, and snippets.

<?php
namespace WebFactory\PurchaseBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use APY\DataGridBundle\Grid\Mapping as Grid;
use Symfony\Component\Validator\Constraints as Assert;
/**
* WebFactory\PurchaseBundle\Entity\Expense
<?php
namespace WebFactory\PurchaseBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use WebFactory\PurchaseBundle\Entity\Expense;
use WebFactory\PurchaseBundle\Form\ExpenseType;
{% extends 'WebFactoryPurchaseBundle::layout.html.twig' %}
{% block content %}
<div class="contenttitle radiusbottom0">
<h2 class="table"><span>{{ 'Expense list'|trans }}</span></h2>
</div><!--contenttitle-->
{{ grid(grid, _self) }}
{% block grid_column_type_filter %}

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.

Ruby on Rails development setup on Ubuntu 12.04

System update

# change mirror to ubuntu.osuosl.org first
sudo apt-get update

Install common libraries

sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

@clubdesarrolladores
clubdesarrolladores / gist:9998563
Last active August 29, 2015 13:58
Reescribir bloque de formulario
{# se pone _ luego el id del campo y por ultimo label, widget, errors o row #}
{% block _dinamico_bundle_contactbundle_message_email_errors %}
{% endblock %}
As of Symfony 2.1 (it may work as well for 2.0 but not sure) to apply theme for collection you do this way:
Lets say we have a collection of products (we have multiple Product entities)
@clubdesarrolladores
clubdesarrolladores / config.yml
Created October 10, 2014 15:59
Correcto uso de Assetic en Symfony
assetic:
filters:
cssrewrite:
apply_to: "\.css$"
less:
node: %node%
node_paths: %node_paths%
@clubdesarrolladores
clubdesarrolladores / gist:1d5497e7acef4da07eee
Last active September 15, 2015 18:45
APY DATA GRID OPERATORS BY TYPE
string
defaultOperator="like", operators={"eq", "neq", "like", "nlike", "rlike", "llike", "isNull", "isNotNull"}
number
defaultOperator="eq", operators={"eq", "neq", "lt", "lte", "gt", "gte", "btw", "btwe", "isNull", "isNotNull"}
boolean
#!/bin/bash
# Put this file at: .git/hooks/post-checkout
# and make it executable
# You can install it system wide too, see http://stackoverflow.com/a/2293578/685587
PREV_COMMIT=$1
POST_COMMIT=$2
GIT_DIR=$(git rev-parse --git-dir)
@clubdesarrolladores
clubdesarrolladores / gist:a174fc502edd1ca622ac
Created November 21, 2014 13:09
Convención traducciones en symfony2
Convenciones sobre traducciones en symfony2.
Se utilizarán claves para crear mensajes traducibles, no se admitirán frases.
Las claves deben escribirse en ingles y utilizando notación underscore.
Para proyectos se utilizará el dominio por defecto (messages y validators).
En bundles reutilizabes se utilizará el underscore del bundle en cuestión.
Por ejemplo para WebFactoryUserBundle utilizamos web_factory_user.
Se utilizará el formato yml dada su estructura de facil lectura y organización.