Skip to content

Instantly share code, notes, and snippets.

View tristanbes's full-sized avatar

Tristan Bessoussa tristanbes

View GitHub Profile
@tristanbes
tristanbes / Book.php
Created March 19, 2012 15:29
How to dynamically add translations to your I18N object using SonataAdminBundle & DoctrineExtensions
<?php
namespace Demo\BookBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Demo\BookBundle\Entity\Book
@tristanbes
tristanbes / Condition.php
Created May 22, 2012 15:11
The form's client data is expected to be of type scalar, but is an instance of class Doctrine\ORM\PersistentCollection
<?php
namespace GamerCertified\TeamBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* GamerCertified\TeamBundle\Entity\Conditions
*
* @ORM\Table(name="conditions")
<?php
[...]
class Car
{
/**
* @ORM\OneToMany(targetEntity="Condition", mappedBy="Car", cascade={"all"}, orphanRemoval=true)
*/
private $conditions;
Failed loading xdebug.so: dlopen(xdebug.so, 9): image not found
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/zend/lib/php_extensions/xdebug.so' -
dlopen(/usr/local/zend/lib/php_extensions/xdebug.so, 9): no suitable image found.
Did find: /usr/local/zend/lib/php_extensions/xdebug.so: mach-o, but wrong architecture in Unknown on line 0
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4
<?php
namespace AwesomeNamespace\AwesomeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* AwesomeNamespace\AwesomeBundle\Entity\Profile
<?php
namespace AwesomeNamespace\AwesomeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
/**
* @ORM\Entity
* @ORM\Table(name="profile_translations",
<?php
namespace AwesomeNamespace\AwesomeBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
/**
* Profile Admin
# Add the bundle to your composer
"a2lix/translation-form-bundle" : "dev-master"
# Enable the Bundle in the AppKernel.php
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),
# Configure the Bundle in the config.yml
@tristanbes
tristanbes / gist:3918310
Created October 19, 2012 13:46
Install Stats.d on a debian server
sudo apt-get update && apt-get install git-core curl build-essential openssl libssl-dev
# Don't forget to go to the location you want to install node in (like cd /home/) before running these commands
git clone https://github.com/joyent/node.git
cd node
git checkout v0.8.12
./configure --openssl-libpath=/usr/lib/ssl
make
make test