Skip to content

Instantly share code, notes, and snippets.

View havvg's full-sized avatar

Toni Uebernickel havvg

View GitHub Profile
[remote "upstream"]
url = git://github.com/fabpot/Sami.git
fetch = +refs/heads/*:refs/remotes/upstream/*
# Github pull requests
fetch = +refs/pull/*/head:refs/gh-pull/remotes/upstream/*
fetch = +refs/pull/*/merge:refs/gh-merge/remotes/upstream/*
@havvg
havvg / StreetAddressType.php
Created December 17, 2012 13:58
Symfony2 Forms: dynamic "NotBlank"-constraints
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Ormigo\Bundle\OrmigoBundle\Form\DataTransformer\StreetAddressModelTransformer;
use Ormigo\Bundle\OrmigoBundle\Form\Validator\StreetAddressValidator;
@havvg
havvg / DateRange.php
Last active October 24, 2021 10:33
Symfony2: poor man's date_range form type
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\Model;
use DateTime;
class DateRange
{
/**
* @var DateTime
@havvg
havvg / AbstractFunctionalTest.php
Created November 30, 2012 09:52
Symfony2 controller test "304 - Not Modified"
<?php
namespace Ormigo\Tests;
use DateTime;
use DateTimeZone;
use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
<?php
$count = 5;
$values = range(20, 50);
var_dump(array_values(array_intersect_key($values, array_flip(array_rand($values, $count)))));
/* Example output
array(5) {
[0]=>
@havvg
havvg / CatchmentAreaType.php
Created November 23, 2012 13:19
Dynamic validation_groups based on choice value
<?php
namespace Ormigo\Bundle\OrmigoBundle\Form\CatchmentArea\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Ormigo\Bundle\OrmigoBundle\Form\CatchmentArea\DataTransformer\CatchmentAreaModelTransformer;
@havvg
havvg / .gitconfig
Created November 2, 2012 15:44
octopus merge pull requests from upstream
[remote "origin"]
fetch = +refs/pull/*/head:refs/gh-pull/remotes/origin/*
[remote "upstream"]
fetch = +refs/pull/*/head:refs/gh-pull/remotes/upstream/*
@havvg
havvg / JasmineHandler.php
Created October 31, 2012 16:57
Symfony2 + Jasmine = JasmineHandler
<?php
namespace Ormigo\Tests;
use Symfony\Component\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response;
class JasmineHandler
{
protected $templating;
@havvg
havvg / DummyType.php
Created October 18, 2012 12:35
Propel ModelType collection
<?php
namespace Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class DummyType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
@havvg
havvg / FieldWhiteListAwareInterface.php
Created October 12, 2012 15:09
Propel ModelCriteriaSubscriber
<?php
namespace Ormigo\Component\Pager;
interface FieldWhiteListAwareInterface
{
/**
* Returns a list of columns valid for sorting.
*
* @return string[]