Skip to content

Instantly share code, notes, and snippets.

@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",
@merk
merk / gist:6137211
Created August 2, 2013 02:58
Service ParamConverter
<?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 / CacheBustingWorker.php
Created July 3, 2013 06:07
CacheBustingWorker for Assetic 1.1.1
<?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 / GlobalVariables.php
Last active December 16, 2015 07:49
Overriding or adding variables to the twig app variable
<?php
namespace Ibms\Helper;
use Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables as BaseGlobalVariables;
use Symfony\Component\DependencyInjection\ContainerInterface;
use DateTime;
class GlobalVariables extends BaseGlobalVariables
{
@merk
merk / JobExtension.php
Created March 27, 2013 23:50
Example Twig Extension
<?php
namespace Ibms\JobBundle\Twig;
use Doctrine\Common\Collections\Collection;
use Ibms\JobBundle\Entity\Job;
use Ibms\JobBundle\Entity\JobAppliance;
use Ibms\UserBundle\Entity\Technician;
use DateTime;
use Symfony\Component\DependencyInjection\ContainerInterface;
@merk
merk / TruncateFixture.php
Last active December 11, 2015 19:58
Truncate workaround for doctrine fixtures
<?php
namespace Ibms\AppBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\Common\Persistence\ObjectManager;
use Infinite\Helper\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
@merk
merk / ApplianceTypeListener.php
Last active October 11, 2015 03:38
Example Form events to modify a form based on other form values
<?php
namespace Ibms\AppBundle\Form\EventListener;
use Doctrine\ORM\QueryBuilder;
use Ibms\SupplierBundle\Entity\Supplier;
use Ibms\SupplierBundle\Entity\SupplierManager;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormFactoryInterface;