Skip to content

Instantly share code, notes, and snippets.

<?php
namespace CommentBundle\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
class CommentFormSubscriber implements EventSubscriberInterface
{
public function form(FormEvent $event)
<?php
// ...
class AbstractInvoiceLineType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
@stof
stof / test.php
Created October 26, 2012 14:54
Testing the PATH for PHP in Gitbash
Calling getenv("Path"):
c:\Users\Christophe COEVOET\bin;.;C:\Program Files (x86)\Git\local\bin;C:\Program Files (x86)\Git\mingw\bin;C:\Program Files (x86)\Git\bin;c:\Ruby193\bin;c:\Program Files\Common Files\Microsoft Shared\Windows Live;c:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\Program Files\CollabNet\Subversion Client;c:\Program Files (x86)\PC Connectivity Solution\;c:\Windows\system32;c:\Windows;c:\Windows\System32\Wbem;c:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files\Intel\DMIX;c:\Program Files\Intel\WiFi\bin\;c:\Program Files\Common Files\Intel\WirelessCommon\;c:\Program Files\WIDCOMM\Bluetooth Software\;c:\Program Files\WIDCOMM\Bluetooth Software\syswow64;c:\Program Files (x86)\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files\NTRU Cryptosystems\NTRU TCG Software Stack\bin\;c:\Program Files\Wave Systems Corp\Gemalto\Access Client\v5\;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLL
@stof
stof / normalizer.php
Created October 5, 2012 12:34 — forked from alexandresalome/normalizer.php
Normalizer for Doctrine entities
<?php
namespace Gitonomy\Bundle\CoreBundle\Serializer\Normalizer;
use Doctrine\Common\Persistence\ManagerRegistry;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
class EntitiesNormalizer implements NormalizerInterface, DenormalizerInterface
{
@stof
stof / gist:3551077
Created August 31, 2012 10:06
Conditional HttpCache for Drupal
<?php
use Drupal\Core\DrupalKernel;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpCache\Esi;
use Symfony\Component\HttpKernel\HttpCache\HttpCache;
use Symfony\Component\HttpKernel\HttpCache\Store;
// Build a drupal kernel
$kernel = new DrupalKernel()
@stof
stof / config.yml
Created August 26, 2012 02:06
Storing Symfony 2.1 sessions outside the cache folder to keep them on deploy
framework:
session:
save_path: "%kernel.root_dir%/sessions/%kernel.environment%"
@stof
stof / gist:3473109
Created August 26, 2012 02:03
BoxFile to deploy a Symfony 2.1 app on Pagodabox
web1:
shared_writable_dirs:
- app/cache
- app/logs
- app/sessions
document_root: web
default_gateway: app.php
index_list: [app.php]
php_version: 5.3.10
php_extensions:
@stof
stof / gist:3179214
Created July 25, 2012 22:54
Behat failures on windows
...F................................................................................................F....................................................................F....F....F....F....F.....................F....F....F-..................................................................................................F......F.........................................................................................................................................................................................................................................................F.....F.....F..........................................................................................................................................................................................................................
(::) failed steps (::)
01. Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
'<?php
@stof
stof / gist:3086842
Created July 10, 2012 23:11
suggestion to use the composer autoloader for PPI
<?php
/**
* @author Paul Dragoonis <[email protected]>
* @license http://opensource.org/licenses/mit-license.php MIT
* @package PPI
* @link www.ppi.io
*/
defined('PPI_VERSION') || define('PPI_VERSION', '2.0');
defined('DS') || define('DS', DIRECTORY_SEPARATOR);
@stof
stof / config.yml
Created June 28, 2012 13:48
FOSJSRoutingBundle with FOSRestBundle
fos_js_routing:
routes_to_expose:
- "^api_.*" # expose all routes with a name starting with api_