Skip to content

Instantly share code, notes, and snippets.

@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 / Enabled.php
Last active November 18, 2015 02:01
Example Specification pattern implementation
<?php
/**
* This file is part of the Infinite SSO 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 / 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;
@merk
merk / config.yml
Created September 13, 2012 06:35
hwioauth fosuserbundle
hwi_oauth:
connect: ~
firewall_name: main
fosub:
username_iterations: 30
properties:
github: github
google: google
resource_owners:
google:
@merk
merk / JobController.php
Last active October 10, 2015 14:17
Use of a FormType to build a filter for a list of entities
<?php
namespace Ibms\JobBundle\Controller;
class JobController extends BaseJobController
{
/**
* Job list.
*
* @param \Symfony\Component\HttpFoundation\Request $request
@merk
merk / mysql.log
Created September 6, 2012 01:55
Differences in queries logged in symfony and mysql
2 Query INSERT INTO payment_instructions (amount, approved_amount, approving_amount, created_at, credited_amount, crediting_amount, currency, deposited_amount, depositing_amount, extended_data, payment_system_name, reversing_approved_amount, reversing_credited_amount, reversing_deposited_amount, state, updated_at) VALUES ('795.85', '0', '0', '2012-09-06 11:53:34', '0', '0', 'AUD', '0', '0', 'a:5:{s:11:\"expiryMonth\";a:3:{i:0;s:56:\"laYg+WRlzAbOFkEOsjOn5AMoFEVRa0HyONOJDsT77G0LL7qn8TDlUec=\";i:1;b:1;i:2;b:1;}s:10:\"expiryYear\";a:3:{i:0;s:52:\"MWYNfAMqfw3CdHzBkmxxqJvc9Ccg4QXnYxWTDRvOW5kyNmp8gA==\";i:1;b:1;i:2;b:1;}s:14:\"cardHolderName\";a:3:{i:0;s:56:\"03XlAKyOdQogZAOb2aGD4CBftkcZD1NcnedaR2CMRvnFkUbXO/kWVNO+\";i:1;b:1;i:2;b:1;}s:32:\"customer.customerReferenceNumber\";a:3:{i:0;s:68:\"LxeMcU+bcWaJDFbdq6lhxX0jp8GSLO6if2Sb8IHSr0RaHD+vUkYssa6Udn6K+i3XNQO4\";i:1;b:1;i:2;b:1;}s:11:\"censoredPan\";a:3:{i:0;s:76:\"h46otrelevM/ihzNcw3C0kDQRxnggFQ38t4e/wi8Scn4Zvs6BzCX/lf/KB3pOFzSkxvxILZs0IU=\";i:1;b:1;i:2;b:1;}}'