Skip to content

Instantly share code, notes, and snippets.

View wouterj's full-sized avatar

Wouter de Jong wouterj

View GitHub Profile
@wouterj
wouterj / explaination.md
Last active August 29, 2015 14:16
The confusing world of Symfony DI configuration files

It all starts with the booting of the kernel, which builds the container. As you see, $this->registerContainerConfiguration() is called (an abstract method)

class Kernel
{
    protected function buildContainer()
    {
        $container = $this->getContainerBuilder();
        $container->addObjectResource($this);
<?php
namespace Kunstmaan\LiveReloadBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files
*
doctrine_phpcr:
# configure the PHPCR session
session:
backend:
logging: true
profiling: true
type: jackrabbit
url: http://localhost:8080/server/ # the URL of the jackrabbit server
parameters:
jackalope.check_login_on_server: false
<?php
$response = new \Response();
try {
$client->buy('sofa');
} catch (\Exception $e) {
foreach ($this->exceptionHandlers as $handler) {
if ($handler->accepts($e)) {
$response = $handler->handle($e, $response);
<?php
// BEFORE
// ...
class FeatureContext
{
public function assertFieldHasErrorMessage($message, $locator)
{
// find fieldset by locator for field
import Data.List (groupBy, sortBy)
getQuantity xs = let countQuantity acc (_, "registered") = succ acc
countQuantity acc (_, "sold") = pred acc
compareASC (i1, _) (i2, _)
| i1 < i2 = LT
| i1 > i2 = GT
| i1 == i2 = EQ
in map (foldl (countQuantity) 0) $ groupBy (\x y -> (fst x) == (fst y)) $ sortBy (compareASC) xs
<?php
// ...
class SiteController extends Controller
{
public function searchAction(Request $request)
{
$query = $request->query->get('query');
<?xml version="1.0" ?>
<xliff version='1.1' xmlns='urn:oasis:names:tc:xliff:document:1.1'>
<file original='NoName' source-language='en' datatype='plaintext'>
<body>
<!-- In Symfony -->
<trans-unit id="apples">
<source>I have %number% apples</source>
<target>{0} I have no apples|{1} I have one apple|]1,Inf] I have %count% apples</target>
</trans-unit>
{
"require": {
"behat/mink-goutte-driver": "~1.0"
}
}
default:
suites:
portal:
contexts: [Behat\MinkExtension\Context\MinkContext, PortalContext]
path: %paths.base%/features
extensions:
Behat\MinkExtension:
base_url: http://st3hoekcp-acc.wonenportaal.nl/
sessions:
default: