Skip to content

Instantly share code, notes, and snippets.

/*
* Use this file to load in some seed data.
*
* $ mysql -u root -p blog_demo < seed_data.sql
*
*/
/* Enable deletion of rows with foreign key constraints by disabled checks */
SET foreign_key_checks = 0;
/**
* Get slug
*
* @return string
*/
@Tocacar
Tocacar / gist:4078423
Created November 15, 2012 12:31
afup talks requiring translation of description to English
The following talks are in English and require translation of their descriptions into English for inclusion on ProTalk:
- Vidéo du Forum PHP : Annotating with Annotations - Rafael DOHMS
- Scaling Communication through Continuous Integration - LB Denker - Forum PHP 2012
- A quick start on Zend Framework 2 - Enrico Zimuel - Forum PHP 2012Denker - Forum PHP 2012
- Magic Behind The Numbers -- Software Metrics In Practice - Seb Marek - Forum PHP 2012
- Video Forum PHP: PHP in 2012 - Rasmus Lerdorf
For ease of reference, the URL to view descriptions is: http://afup.org/pages/forumphp2012/
@Tocacar
Tocacar / gist:4205314
Created December 4, 2012 15:44
Symfony 2 entity field type problem
//GrantType form class
$builder->add('funder', 'entity', array(
'label' => 'funder',
'class' => 'Grants\CoreBundle\Entity\Funder',
'property' => 'name',
'empty_value' => 'Choose a funding body'
));
@Tocacar
Tocacar / gist:4337861
Created December 19, 2012 16:06
I need to create a custom DataSourceIterator so that I can pass a related collection's properties to the sonata admin bundle's exportAction (I think this is the only way to achieve the export of one-to-many values, I may be wrong). I have traced backwards how my admin class is currently generating a DataSourceIterator (I think) - see below. Pres…
// vendor/sonata-project/admin-bundle/Sonata/AdminBundle/Admin/Admin.php
/**
* @return
*/
public function getDataSourceIterator()
{
$datagrid = $this->getDatagrid();
$datagrid->buildPager();
<?php
require_once dirname(__DIR__).'/../../../../app/AppKernel.php';
/**
* Test case class helpful with Entity tests requiring the database interaction.
* For regular entity tests it's better to extend standard \PHPUnit_Framework_TestCase instead.
*/
abstract class KernelAwareTest extends \PHPUnit_Framework_TestCase
{
class CostCentreManager
{
protected $grant;
protected $notice;
protected $validators = array();
public function __construct(
Validator $costCentreNotRequired,
Validator $hasCostCentre,
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cd /tmp/vagrant-puppet/manifests && puppet apply --verbose --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' default.pp --detailed-exitcodes || [ $? -eq 2 ]
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.56.101"
config.ssh.forward_agent = true
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]