Skip to content

Instantly share code, notes, and snippets.

View weaverryan's full-sized avatar

Ryan Weaver weaverryan

View GitHub Profile
@weaverryan
weaverryan / ApiProblem.php
Created April 21, 2015 10:06
ApiProblem wrapper class example
<?php
namespace AppBundle\Api;
use Symfony\Component\HttpFoundation\Response;
/**
* A wrapper for holding data to be used for a application/problem+json response
*/
class ApiProblem
{
@weaverryan
weaverryan / ApiTestCase.php
Last active September 23, 2019 15:22
Example Symfony ApiTestCase (from WIP KnpUniversity Symfony REST tutorial)
<?php
namespace AppBundle\Tests\Controller\Api;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\ORM\EntityManager;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Message\ResponseInterface;
use GuzzleHttp\Subscriber\History;
@weaverryan
weaverryan / UniversityExtension.php
Last active July 9, 2018 16:16
Twig Extension with ContainerInterface injected
<?php
class UniversityExtension extends \Twig_Extension
{
private $container;
/**
* An internal cache used to prevent creating this chain loader multiple times
*/
private $twigChainLoader;
@weaverryan
weaverryan / do-it.md
Last active August 29, 2015 14:10
OS Binge Sunday
@weaverryan
weaverryan / output.md
Created July 5, 2014 12:28
Example Table for Dcotrine command
Name Type Length nullable unique
firstName string 255 false false
email string 128 false true
@weaverryan
weaverryan / README.md
Last active August 29, 2015 14:03
Welcome to the Symfony Community Hack Day May 23rd, 2015

It's a Community Hack Day!

Welcome! No matter what you're level of Symfony, we have plenty of things we need help with! This document will guide you through everything:

Where are we meeting?

We're meeting on Freenode in the #symfony-docs channel. Come hang out!

What can I work on?

@weaverryan
weaverryan / FeatureContext.php
Created January 22, 2014 23:27
The Symfony2Extension
<?php
// ...
use Behat\MinkExtension\Context\MinkContext;
use Behat\Symfony2Extension\Context\KernelAwareInterface;
use Symfony\Component\HttpKernel\KernelInterface;
class FeatureContext extends MinkContext implements KernelAwareInterface
{
private $kernel;
<?php
$builder->add(
$builder->create('issue', 'text')
->addModelTransformer(new CallbackTransformer(
function($val) { return 'foo'; },
function($val) { return 'bar'; },
))
);
@weaverryan
weaverryan / README.md
Last active May 20, 2016 17:16
SymfonyCon 2013 Documentation Hackday Details!

It's a Doc Hack Day!

Whether you're in Warsaw or remote and no matter what you're level of Symfony or how you feel about your English (I'm sure it's just fine), we have plenty of things we need help with! This document will guide you through everything:

Where are we meeting?

In Warsaw of course! But also on Freenode in the #symfony-docs channel. Come hang out!

What can I work on?

@weaverryan
weaverryan / gender-neutral.txt
Created December 3, 2013 17:56
Gender-Neutral Tech doc changes
Symfony: https://github.com/symfony/symfony-docs/commit/0bcc16bf9b8f67c349b12a17d88d5fa8251f51d0
Django: https://github.com/django/django/commit/c0a2daad78c66def2ce6592977b78dab6475dd53
Rails: https://github.com/rails/rails/commit/6f0fb7ba25b288ed8930b117a5db51123e6df582
libuv: https://github.com/joyent/libuv/pull/1015/files