Skip to content

Instantly share code, notes, and snippets.

View iampersistent's full-sized avatar

Corvus Meliora iampersistent

  • https://xaddax.ai
View GitHub Profile
@beberlei
beberlei / MyWebTestCase.php
Created September 17, 2011 12:14
Easily Inject authenticated Symfony User into functional test
<?php
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @group functional
*/
@schmittjoh
schmittjoh / AjaxFailureHandler.php
Created June 12, 2011 09:48
Twitter Anywhere Authentication
<?php
namespace Security\Authentication;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
class AjaxFailureHandler implements AuthenticationFailureHandlerInterface
Parameters:
forum.repository.topic.class
forum.controller.topic.class
forum.form.topic.class
Serices:
forum.repository.topic
forum.controller.topic
<?php
/**
* @mongodb:Document
*/
class Band
{
/**
* @mongodb:Field(type="string")
* @var string
<?php
class Tag
{
public function normalizeName($name)
{
$normal = trim($name);
$normal = strtolower($normal);
return $normal;
@weaverryan
weaverryan / Basic Twig
Created October 28, 2010 23:39
Here's a small victory for a Twig noob
<div id="breadcrumbs">
{% for breadcrumb in breadcrumbs %}
{% if not loop.last %}
{{ breadcrumb | raw }} {{ breadcrumbs.separator | raw }}
{% else %}
<strong>{{ breadcrumb.label }}</strong>
{% endif %}
{% endfor %}
</div>
<?php
/**
* The problem
* -----------
* People start to build Symfony2 Bundles which need a database.
* Instead of having ORM-only Bundles and ODM-only Bundles,
* people try to make Bundles more generic, for obvious reasons.
*
* A proposition