Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env php
<?php
$rules = [
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => true,
'phpdoc_order' => true,
];
$excludedPaths = [
#!/usr/bin/env php
<?php
$finder = PhpCsFixer\Finder::create()
->exclude([
'app/config',
'app/data',
'app/Resources',
'var',
'web/bundles',
'web/css',
#!/usr/bin/env php
<?php
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => ['syntax' => 'short'],
'ordered_imports' => true,
'phpdoc_order' => true,
<?php
namespace CommonBundle\Twig;
use Symfony\Bridge\Twig\Form\TwigRenderer;
use Symfony\Component\Form\FormView;
class FormSubmitExtension extends \Twig_Extension
{
/**
<?php
namespace App\Services\Rest\Helper;
use App\Utils\JSON;
use Symfony\Component\HttpFoundation\Request as HttpFoundationRequest;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
<?php
namespace CommonBundle\Service;
use Symfony\Component\Templating\EngineInterface;
class SendMail extends \Swift_Message
{
/**
* @var string
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
throw new \RuntimeException('This migration is not reversible');
<?php
use Silex\Application;
use Demo\Repository\PostRepository;
$app = new Application();
$app['dao.article'] = function() {
// $app['db'] def and $app['dao.user'] defined elsewhere
$articleDAO = new ArticleDAO($app['db']);
@ABM-Dan
ABM-Dan / EntityManager.php
Created September 12, 2016 22:27
Holy hardcoded system, Batman!
/**
* {@inheritDoc}
*/
public function newHydrator($hydrationMode)
{
switch ($hydrationMode) {
case Query::HYDRATE_OBJECT:
return new Internal\Hydration\ObjectHydrator($this);
public function pruneEntitiesOlderThan($cutoffTime)
{
return $this->createQueryBuilder('w')
->delete()
->join('w.lot', 'l')
->where('l.sale_date < :cutoff_time')
->setParameter('cutoff_time', strtotime('-'.$cutoffTime.' day'))
->getQuery()