Skip to content

Instantly share code, notes, and snippets.

View wouterj's full-sized avatar

Wouter de Jong wouterj

View GitHub Profile
<?php
namespace spec\Wj\Stoffer;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Wj\Stoffer\Scissors\ScissorsInterface;
class KernelSpec extends ObjectBehavior
{
<?php
namespace Wj\Stoffer\Scissors;
class Line
{
private $input;
public function __construct($input)
{
<?php
// inside tests
$event = \Mockery::mock('Wj\ShiftSymfonyBundle\Event\RequestEvent');
$event->shouldReceive('getRequest')
->atLeast()->once();
// the class
class RequestEvent
{
@wouterj
wouterj / README.md
Last active December 31, 2015 07:49 — forked from weaverryan/README.md

It's a Doc Hack Day!

Welcome! 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?

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

What can I work on?

@wouterj
wouterj / f.php
Last active December 31, 2015 04:49
<?php
/**
* Implementation of FooInterface.
*/
class FooClass implements FooInterface
{
/**
* @var array
*/
<?php
// ...
class MyAwesomeController extends Controller
{
public function uselessAction(Request $request)
{
$user = new User();
<?php
namespace Wj\ForumBundle\Document;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @PHPCR\Document(referenceable=true)
*/
<?php
class PostController extends Controller
{
public function showAction($slug, $_template)
{
$post = $this->someBackend->findBySlug($slug);
return $this->render($_template, ['post' => $post]);
}
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services">
<config xmlns="http://symfony.com/schema/dic/framework_extra">
<router annotations="true" />
<request converters="true" />
<view annotations="true" />
<cache annotations="true" />
</config>
</container>

Every request, get the current logged in user (on the PC, no idea how they plan to implement this) and authenticate this user in the app (creating a new user if it doesn't exists yet).