Skip to content

Instantly share code, notes, and snippets.

@merk
merk / AbstractInvoiceLineType.php
Created July 6, 2012 06:07
Symfony2 Form Polycollection for use with objects in an inheritance structure
<?php
// ...
class AbstractInvoiceLineType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
// ...
@merk
merk / Customer.php
Created June 6, 2012 10:41
ResolveTargetEntityListener examples
<?php
// src/Acme/AppBundle/Entity/Customer.php
namespace Acme\AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Acme\CustomerBundle\Entity\Customer as BaseCustomer;
use Acme\InvoiceBundle\Model\InvoiceSubjectInterface;
@merk
merk / AppKernel.php
Last active May 16, 2019 16:42
Overridden GlobalVariables object to add more to the twig {{ app }} global variable
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
// ....
protected function getKernelParameters()
@merk
merk / Debug.php
Last active September 25, 2017 09:56
Debug helpers for Symfony2/Twig
<?php
namespace Infinite\Helper\Twig;
use Doctrine\Common\Util\Debug as DoctrineDebug;
class Debug extends \Twig_Extension
{
/**
* Returns a list of global functions to add to the existing list.
@merk
merk / FormFactoryTrait.php
Created November 22, 2013 11:37
FormFactoryTrait
<?php
/**
* This file is part of the Infinite Helper library
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@merk
merk / Timestampable.php
Created September 16, 2013 03:15
Timestampable trait
<?php
/**
* This file is part of the Infinite Helper Library
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@merk
merk / TwigExceptionListener.php
Created September 13, 2013 03:59
Disable 404 errors
<?php
/**
* This file is part of IBMS
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@merk
merk / collections.js
Created September 6, 2013 00:47
Symfony2 form collection javascript
/**
* This file is part of the InfiniteFormBundle package.
*
* (c) Infinite Networks Pty Ltd <http://infinite.net.au>
*/
/**
* Provides helper javascript for handling adding and removing
* items from a form collection.
*
@merk
merk / UserController.php
Last active December 22, 2015 08:19
User View Model
<?php
/**
* This file is part of the Project
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@merk
merk / Controller.php
Last active December 20, 2015 13:18
Service ParamConverter
<?php
class CustomerController extends BaseCustomerController
{
/**
* Renders an appliance choice form allowing the user to
* add an appliance if the required one doesnt exist.
*
* @ParamConverter("customer", converter="service", options={
* "service" = "ibms_customer.customer_manager",