Skip to content

Instantly share code, notes, and snippets.

View leopro's full-sized avatar

Leonardo Proietti leopro

  • Director of Software Engineering at MyTutor
  • @_leopro_
View GitHub Profile
<?php
class FactoryCompilerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$predisClientId = $container->getParameter('predis_client_id');
if (!$container->hasDefinition($predisClientId)) {
throw new ServiceNotFoundException($predisClientId);
Acme\Uuid:
type: embeddable
id:
uuid:
type: string
length: 36
<?php
class Child extends Mother
{
private $fieldsCount;
public function __construct()
{
$this->fieldsCount = 5;
}
<?php
/**
* @Route("/{accreditamento_id}/{anagrafica_id}/crea/pdf/", name="pdf_create")
* @ParamConverter("accreditamento", class="AccreditamentiCongressiBundle:Accreditamento", options={"id" = "accreditamento_id"})
* @ParamConverter("anagrafica", class="AccreditamentiCongressiBundle:Anagrafica", options={"id" = "anagrafica_id"})
*/
public function creaPdfCertificatoAction(Accreditamento $accreditamento, Anagrafica $anagrafica) {
<?php
$profiler = $this->client->getKernel()->getContainer()->get('profiler');
$collectors = $profiler->all();
foreach ($collectors as $collector) {
echo get_class($collector) . "\n";
}
<?php
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use ImportCommand;
class ImportCommandTest extends WebTestCase
{
public function setUp()
{
@leopro
leopro / Portal.php
Last active October 13, 2015 01:28
<?php
public function getRepository($name)
{
$em = $this->getEntityManager();
$entity = $this->getExtendedEntity($name);
if (is_null($entity)) {
$entity = $this->getDefaultEntity($name);
}
@leopro
leopro / ControllerExtendableListener.php
Created September 4, 2012 14:58
Runtime controller extension
<?php
namespace Edimotive\SaloneBundle\Service;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Edimotive\SaloneBundle\Service\ControllerExtendableInterface;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Edimotive\SaloneBundle\Service\CustomControllerManager;
@leopro
leopro / app.php
Last active October 9, 2015 11:48
require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppCache($kernel);
public function indexAction($search)
{
if ( true === $search ) {
}
}