Skip to content

Instantly share code, notes, and snippets.

View afurculita's full-sized avatar
👽
Searching for intelligent life

Alexandru Furculita afurculita

👽
Searching for intelligent life
View GitHub Profile
@afurculita
afurculita / README.md
Created December 27, 2016 17:15 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@afurculita
afurculita / commit-msg
Created October 2, 2015 09:59 — forked from shytikov/commit-msg
commit-msg hook script
#!/bin/sh
#
# Automatically adds branch name and branch description to every commit message.
#
NAME=$(git branch | grep '*' | sed 's/* //')
DESCRIPTION=$(git config branch."$NAME".description)
TEXT=$(cat "$1" | sed '/^#.*/d')
if [ -n "$TEXT" ]
then
<?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
{
@afurculita
afurculita / CustomHandler.php
Last active August 29, 2015 14:18 — forked from baldurrensch/CustomHandler.php
This is a handler for the JMS serializer to handle parent and child type serialization. You need to set the type of your collection as `@Type("\Acme\MyBundle\Model\ChildType")`, so that the serializer picks up the handler correctly. Also remember that you need to hook up the handler as a service (and give it the correct tag).
<?php
namespace Acme\MyBundle\Serializer\Handler;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\EventDispatcher\Event;
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\XmlSerializationVisitor;
use JMS\Serializer\GenericSerializationVisitor;