Skip to content

Instantly share code, notes, and snippets.

Avatar

Tristan Bessoussa tristanbes

View GitHub Profile
@tristanbes
tristanbes / Book.php
Created Mar 19, 2012
How to dynamically add translations to your I18N object using SonataAdminBundle & DoctrineExtensions
View Book.php
<?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
The form's client data is expected to be of type scalar, but is an instance of class Doctrine\ORM\PersistentCollection
View Condition.php
<?php
namespace GamerCertified\TeamBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* GamerCertified\TeamBundle\Entity\Conditions
*
* @ORM\Table(name="conditions")
View Car.php
<?php
[...]
class Car
{
/**
* @ORM\OneToMany(targetEntity="Condition", mappedBy="Car", cascade={"all"}, orphanRemoval=true)
*/
private $conditions;
View gist:3150616
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
View gist:3150677
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4
View Category.php
<?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
View ProfileTranslation.php
<?php
namespace AwesomeNamespace\AwesomeBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
/**
* @ORM\Entity
* @ORM\Table(name="profile_translations",
View ProfileAdmin.php
<?php
namespace AwesomeNamespace\AwesomeBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
/**
* Profile Admin
View config
# 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 Oct 19, 2012
Install Stats.d on a debian server
View gist:3918310
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
You can’t perform that action at this time.