Skip to content

Instantly share code, notes, and snippets.

View rufinus's full-sized avatar

Ludwig Ruderstaller rufinus

View GitHub Profile
1. In twig, what do you use if you want to optimize the size of the generated HTML content?
a. spaceless
b. gzip
c. operators
the spaceless tag
answer is b
really ?
twig supports gzip ?
don't look up
cilex/cilex 1.1.0 The PHP micro-framework for Command line tools based on the Symfony2 Components
cilex/console-service-provider 1.0.0 Console Service Provider
doctrine/annotations v1.2.0 Docblock Annotations Parser
doctrine/lexer v1.0 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
dompdf/dompdf v0.6.1 DOMPDF is a CSS 2.1 compliant HTML to PDF converter
erusev/parsedown 1.0.1 Parser for Markdown.
jms/metadata 1.5.1 Class/method/property metadata management in PHP
jms/parser-lib 1.0.0 A library for easily creating recursive-descent parsers.
jms/serializer 0.16.0 Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.
knpla
<?php
namespace Cwd\GenericBundle\Repository;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
use Gedmo\Exception\InvalidArgumentException;
use Gedmo\Tree\RepositoryUtils as GedmoRepositoryUtils;
class RepositoryUtils extends GedmoRepositoryUtils
@rufinus
rufinus / MandatorType <2.6
Last active August 29, 2015 14:12
Symfony FormType <2.6 what is the >=2.6 way? Without needing OptionsResolverInterface?
<?php
namespace Dpanel\Bundle\AdminBundle\Forms;
use Cwd\GenericBundle\Doctrine\EntityRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
return array(
'controllers' => array(
'initializers' => array(
function ($instance, $serviceManager) {
if ($instance instanceof EntityManagerAwareInterface) {
if($serviceManager->has('doctrine.entitymanager.orm_default')) {
$instance->setEntityManager($serviceManager->get('doctrine.entitymanager.orm_default'));
}
}
[...]
@rufinus
rufinus / 1-services.config.php
Created November 6, 2012 14:17
ZF2 Service Layout - request for Comments
<?php
namespace Admin;
return array(
'invokables' => array(
'serviceFactory' => 'cwdAdmin\Service\ServiceFactory',
),
'factories' => array(
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
@rufinus
rufinus / module.config.php
Created November 8, 2012 15:22
Zend Cache for I18N
return array(
'factories' => array(
'translator' => 'Zend\I18n\Translator\TranslatorServiceFactory',
'default_cache' => function($sm) {
$cache = \Zend\Cache\StorageFactory::factory(array(
'adapter' => array(
'name' => 'apc',
'options' => array(
),
),
@rufinus
rufinus / helper
Created November 9, 2012 16:23
Type in flashmessenger
class ShowMessages extends AbstractHelper
{
/**
* FlashMessenger
* @var unknown_type
*/
protected $_fm = NULL;
public function __construct(FlashMessenger $fm)
{
@rufinus
rufinus / A_Form.php
Created November 12, 2012 13:53
Where is my Service Locator gone?
<?php
namespace Admin\Form;
use Zend\Form\Element\Select;
class Agency extends Form {
public function __construct()
{
@rufinus
rufinus / 1-controller.php
Created November 12, 2012 16:54
currently
public function createAction()
{
$service = $this->getService();
$form = $service->getForm();
$entity = $service->getEntity();
$form->bind($entity);
if($this->request->isPost()) {
$mandator = $this->getEntityManager()->find('Admin\Entity\Mandator', $_POST['mandator_id']); //<--- should not be needed