Skip to content

Instantly share code, notes, and snippets.

@giorrrgio
Last active January 11, 2017 05:24
Show Gist options
  • Save giorrrgio/d4395afe470a1ad223e0 to your computer and use it in GitHub Desktop.
Save giorrrgio/d4395afe470a1ad223e0 to your computer and use it in GitHub Desktop.
<?php
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$kernel = new AppCache($kernel);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
<?php
class HttpCache implements HttpKernelInterface, TerminableInterface
{
private $kernel;
[...]
public function __construct(HttpKernelInterface $kernel, [...])
{
$this->store = $store;
$this->kernel = $kernel;
[...]
}
services:
my.gorgeous.repository:
class: My\Gorgeous\Repository\SuperPowerRepository
factory_service: doctrine.orm.default_entity_manager
factory_method: getRepository
arguments:
- MyGorgeousBundle:SuperPower
<?php
$task = new Task();
$task->setTask('Write a blog post');
$task->setDueDate(new \DateTime('tomorrow'));
$form = $this->createFormBuilder($task)
->add('task', 'text')
->add('dueDate', 'date')
->add('save', 'submit')
->getForm();
<?php
interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface
{
public function add($child, $type = null, array $options = array());
public function create($name, $type = null, array $options = array());
public function get($name);
public function remove($name);
public function has($name);
public function all();
public function getForm();
}
<?php
interface FragmentRendererInterface
{
public function render($uri, Request $request, array $options = array());
public function getName();
}
<?php
abstract class RoutableFragmentRenderer implements FragmentRendererInterface
{
//[...]
}
class EsiFragmentRenderer extends RoutableFragmentRenderer
{
//[...]
{
class HIncludeFragmentRenderer extends RoutableFragmentRenderer
{
//[...]
}
<?php
interface HttpKernelInterface
{
const MASTER_REQUEST = 1;
const SUB_REQUEST = 2;
/** Handles a Request to convert it to a Response. */
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
}
<?php
protected function initializeContainer()
{
$class = $this->getContainerClass();
//omitted caching stuff
$this->container = new $class();
$this->container->set('kernel', $this);
if (!$fresh && $this->container->has('cache_warmer')) {
$this->container->get('cache_warmer')->warmUp($this->container->getParameter('kernel.cache_dir'));
}
}
<?php
class Mailer
{
protected $transport;
public function __construct(MyTransportInterface $transport)
{
$this->transport = $transport;
}
public function sendEmailMessage($body, $subject, $from, $to)
{
//do stuff
$this->transport->send($body, $subject, $from, $to);
}
}
<?php
namespace Symfony\Component\Validator;
interface MetadataInterface
{
public function accept(ValidationVisitorInterface $visitor, $value, $group, $propertyPath);
public function findConstraints($group);
}
<?php
class NewsletterFactory
{
public function get()
{
$newsletterManager = new NewsletterManager();
// ...
return $newsletterManager;
}
}
parameters:
# ...
newsletter_manager.class: NewsletterManager
newsletter_factory.class: NewsletterFactory
services:
newsletter_manager:
class: "%newsletter_manager.class%"
factory_class: "%newsletter_factory.class%"
factory_method: get
#php composer.phar require symfony/proxy-manager-bridge:2.3.*
services:
foo:
class: Acme\Foo
lazy: true
<?php
interface SecurityFactoryInterface
{
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint);
public function getPosition();
public function getKey();
public function addConfiguration(NodeDefinition $builder);
}
<?php
namespace Symfony\Component\Validator;
interface ValidationVisitorInterface
{
public function validate($value, $group, $propertyPath, $traverse = false, $deep = false);
public function visit(MetadataInterface $metadata, $value, $group, $propertyPath);
}
@liuggio
Copy link

liuggio commented Oct 13, 2013

<?php

interface HttpKernelInterface
{
    const MASTER_REQUEST = 1;
    const SUB_REQUEST = 2;
    /** Handles a Request to convert it to a Response. */
    public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true);
}

@liuggio
Copy link

liuggio commented Oct 14, 2013

<?php

namespace MongoDBODMProxies\__CG__\Acme\CartBundle\Document;

use Doctrine\ODM\MongoDB\Persisters\DocumentPersister;

/**
 * THIS CLASS WAS GENERATED BY THE DOCTRINE ODM. DO NOT EDIT THIS FILE.
 */
class Cart extends \Acme\CartBundle\Document\Cart implements \Doctrine\ODM\MongoDB\Proxy\Proxy
{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment