Skip to content

Instantly share code, notes, and snippets.

View SebLours's full-sized avatar

Sébastien Lourseau SebLours

View GitHub Profile
@SebLours
SebLours / SoftDeleteableEnabledCommand.php
Last active August 24, 2016 12:54
Show all softdeleteable entities class name (not for annotation config)
<?php
namespace AppBundle\Command;
use Doctrine\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper;
use Gedmo\Mapping\ExtensionMetadataFactory;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
@SebLours
SebLours / index.html
Created July 28, 2016 12:57
Sortable table rows (anuglar + ng-sortable)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Drag &amp; Drop table rows</title>
<script src="https://code.angularjs.org/1.5.8/angular.min.js"></script>
<script src="https://raw.githubusercontent.com/a5hik/ng-sortable/master/dist/ng-sortable.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
@SebLours
SebLours / FlexibleEntityNormalizer.php
Created February 25, 2016 10:26
Pomm flexible entity serializer normalizer
<?php
namespace Acme\Component\Serializer\Normalizer;
use PommProject\ModelManager\Model\FlexibleEntity;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class FlexibleEntityNormalizer implements NormalizerInterface
{
/**
<?php
namespace AppBundle\Pomm\Resolver;
use ArrayObject;
use PommProject\ModelManager\Model\FlexibleEntity;
class ModelClassResolver extends ArrayObject
{
/**
@SebLours
SebLours / DurationTransformer.php
Created July 5, 2015 13:40
Symfony2 duration datatransformer
<?php
namespace AppBundle\Form\DataTransformer;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;
class DurationTransformer implements DataTransformerInterface
{
/**
@SebLours
SebLours / Paginator.php
Last active August 29, 2015 14:17
Simple adaptation of the Doctrine ORM Paginator (Doctrine\ORM\Tools\Pagination\Paginator) for Doctrine ODM MongoDB
<?php
namespace AppBundle\Doctrine\ODM\Pagination;
use Doctrine\ODM\MongoDB\Query\Builder;
use Doctrine\ODM\MongoDB\Query\Query;
/**
* Simple adaptation of Doctrine\ORM\Tools\Pagination\Paginator
* for Doctrine ODM MongoDB
@SebLours
SebLours / SortableNullsWalker.php
Last active February 15, 2018 16:30
The SortableNullsWalker is a TreeWalker that walks over a DQL AST and constructs the corresponding SQL to allow ORDER BY IS NULL http://devandco.wordpress.com/2013/11/23/doctrine-mysql-isnull/
<?php
namespace Application\DoctrineExtensions\Query\MySql;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\DBAL\DBALException;
/**
* $query = $qb->getQuery();
* $query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, '\Namespace\DoctrineExtensions\Query\MySql\SortableNullsWalker');