Skip to content

Instantly share code, notes, and snippets.

Warnar Boekkooi boekkooi

Block or report user

Report or block boekkooi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
boekkooi / CustomPropertyAccessor.php
Last active Sep 26, 2019
Using a custom property path for symfony forms set / get path
View CustomPropertyAccessor.php
use Symfony\Component\PropertyAccess\PropertyAccessor;
use Symfony\Component\PropertyAccess\PropertyPath;
* A property accessor that allows you to rewrite a property path for setters and getters.
class CustomPropertyAccessor extends PropertyAccessor
View JsonSerializableNormalizer.php
namespace Acme\Serializer\Normalizer;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class JsonSerializableNormalizer implements NormalizerInterface
* @inheritdoc
View ExampleMailer.php
final class ExampleMailer extends Mailer
protected $parameters;
public function __construct(\Swift_Mailer $mailer, UrlGeneratorInterface $router, \Twig_Environment $twig, array $parameters)
parent::__construct($mailer, $router, $twig);
$this->parameters = $parameters;
boekkooi / Collection.php
Created Sep 14, 2015
ValueObject + Broadway
View Collection.php
namespace Xoip\Component\ValueObject;
interface Collection extends \IteratorAggregate, \Countable
* Adds an element at the end of the collection.
* @param ValueObject $object The object to add.
boekkooi / ConstructorMapper.php
Last active Jul 1, 2018
Symfony Form DataMapper using object constructors
View ConstructorMapper.php
namespace Acme\Symfony\Form\DataMapper;
use Symfony\Component\Form\Exception\TransformationFailedException;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
class ConstructorMapper extends PropertyPathMapper
boekkooi /
Last active Aug 29, 2015
Openshift + Phalcon

Create your openshift application (,

rhc create-app myapp
rhc cartridge add -a myapp

Now checkout the repo. Modify .openshift/nginx.conf.erb to look like this gists 1_nginx.conf.erb and add .openshift/action_hooks/build with the content of this gists 2_build (make sure to do chmod +x) also add .openshift/php-pecl.txt. with the content of 3_php-pecl.txt

Commit and push and you'r done.

boekkooi / DataMapper.php
Created Feb 24, 2015
Event sourced form mapping
View DataMapper.php
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
* Custom datamapper
* This uses normal getters to fill the form using PropertyPathMapper.
* But for setters it go's the custom route.
View EventListener\EntityReferenceEventSubscriber.php
namespace Boekkooi\Bundle\FrameworkBundle\EventListener;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Tools\AttachEntityListenersListener;
boekkooi / deep_copy
Created Nov 28, 2014
Deep copy Array
View deep_copy
function arrayCopy(array $array)
$hashList = array();
$iterator = new \RecursiveIteratorIterator(
new \RecursiveArrayIterator($array),
View gist:abdd30d472b7b6bd3227
const SIP_PATTERN = '~^
(?<user>(?:[a-z0-9\-_\.!\~*\'\(\)]|%[0-9a-f]{2}|[&=\+$,;?\/])+) # user ( unreserved / escaped / user-unreserved )
(?::(?<password>(?:[a-z0-9\-_\.!\~*\'\(\)]|%[0-9a-f]{2}|[&=\+$,])+))? # password ( unreserved / escaped / "&" / "=" / "+" / "$" / "," )
@)? # userinfo
(?:[\pL\pN\pS-\.])+(?:\.?(?:[\pL]|xn\-\-[\pL\pN-]+)+\.?) # a domain name
| # or
You can’t perform that action at this time.