Skip to content

Instantly share code, notes, and snippets.

<?php
$formView = $form->createView();
$renderedFormView = $formRenderer->searchAndRenderBlock($formView, 'rest'); // Object graph of FormRepresentation and InputRepresentation
$content = $this->get('serializer')->serialize($renderedFormView, $format);
<?php
class OptionA
{
/**
* @var \DateTime $date
*/
private $date;
// the $date in the docblock seems redundant?
}
{
"require": {
"friendsofsymfony/rest-bundle": "dev-master",
"jms/serializer-bundle": "dev-xml-attribute-map as 0.9.0",
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/adrienbrault/JMSSerializerBundle"
}
<?php
$dateInterval = new \DateInterval('PT35S');
$format = 'P';
if (0 < $dateInterval->y) {
$format .= '%yY';
}
if (0 < $dateInterval->m) {
$format .= '%mM';
@adrienbrault
adrienbrault / commits.txt
Created July 30, 2012 21:03
A list i keep of all commits - Yep atm im a phpdoc guy
https://github.com/symfony/symfony/commits?author=adrienbrault
https://github.com/symfony/symfony-docs/commits?author=adrienbrault
https://github.com/sensio/SensioFrameworkExtraBundle/commits?author=adrienbrault
https://github.com/doctrine/orm-documentation/commits?author=adrienbrault
https://github.com/composer/composer/commits?author=adrienbrault
https://github.com/swiftmailer/swiftmailer/commits?author=adrienbrault
https://github.com/fabpot/Twig/commits?author=adrienbrault
https://github.com/fabpot/Silex/commits?author=adrienbrault
https://github.com/doctrine/doctrine2/commits?author=adrienbrault
https://github.com/doctrine/dbal/commits?author=adrienbrault
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.16470588743686676</real>
<key>Green Component</key>
<real>0.20784313976764679</real>
@adrienbrault
adrienbrault / gist:3070874
Created July 8, 2012 13:03
Download symfony, and run the tests for master
git clone git://github.com/symfony/symfony.git symfony
cd symfony
git checkout master
curl -s http://getcomposer.org/installer | php
php composer.phar update --dev
phpunit
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
{
"name": "jms/payment-core-bundle",
"type": "symfony-bundle",
"description": "This bundle is providing the foundation for various payment plugins.",
"keywords": ["payment"],
"homepage": "http://jmsyst.com/bundles/JMSPaymentCoreBundle",
"license": "Apache2",
"authors": [
{
"name": "Johannes M. Schmitt",
// On utilise toujours ca ....
try {
$result = $qb->getQuery()->getSingleResult();
} catch (NoResultException $e) {
$result = null;
}
// Mais magie, magie, cette méthode non documentée fait la meme chose!
$result = $qb->getQuery()->getOneOrNullResult();