Skip to content

Instantly share code, notes, and snippets.

@merk
merk / Menu.php
Created May 7, 2012 03:15
Event driven menus
<?php
/*
* TODO: Copyright notices on Infinite Networks files.
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au/>
*/
namespace Infinite\MenuBundle\Menu;
SELECT count(DISTINCT i0_.id) AS sclr0 FROM ibms_part i0_ LEFT JOIN ibms_supplier i1_ ON i0_.supplier_id = i1_.id
Parameters: { }
Time: 0.34 ms
SELECT DISTINCT i0_.id AS id0 FROM ibms_part i0_ LEFT JOIN ibms_supplier i1_ ON i0_.supplier_id = i1_.id LIMIT 15 OFFSET 0
Parameters: { }
Time: 0.35 ms
SELECT i0_.id AS id0, i0_.name AS name1, i0_.dateAdded AS dateAdded2, i0_.dateUpdated AS dateUpdated3, i0_.sku AS sku4, i0_.notes AS notes5, i0_.basePrice AS basePrice6, i0_.cost AS cost7, i1_.id AS id8, i1_.name AS name9, i1_.dateAdded AS dateAdded10, i1_.dateUpdated AS dateUpdated11, i1_.abn AS abn12, i1_.accountNumber AS accountNumber13, i1_.phone AS phone14, i1_.fax AS fax15, i0_.supplier_id AS supplier_id16 FROM ibms_part i0_ LEFT JOIN ibms_supplier i1_ ON i0_.supplier_id = i1_.id WHERE i0_.id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Parameters: ['63', '65', '68', '70', '74', '76', '80', '82', '84', '85', '87', '90', '64', '67', '69']
<?php
public function contactAction()
{
/** @var \Infinite\ContactBundle\Form\Handler\ContactFormHandler $formHandler */
$formHandler = $this->get('infinite_contact.contact.form.handler');
if ($formHandler->process()) {
return $this->redirect($this->generateUrl('InfiniteContactBundle_contact_sent'));
}
@merk
merk / composer.json
Created April 12, 2012 01:03
FOSUserBundle composer.json fix - TEMPORARY
This is a temporary fix due to history change in FOSUserBundle that has not yet propagated to packagist.
"repositories": [
{
"type": "vcs",
"url": "http://github.com/FriendsOfSymfony/FOSUserBundle"
}
]
➜ CommentBundle git:(more_testing) ✗ Tests/Functional/app/console behat --verbose
Feature: Embed a thread on a page
Background: # Features/EmbedThread.feature:3
Given I have a thread identified by "test" with a link of "test" # FOS\CommentBundle\Features\Context\FeatureContext::iHaveAThreadIdentifiedBy()
Scenario: Embed a thread inline # Features/EmbedThread.feature:6
When I go to "inline/test" # FOS\CommentBundle\Features\Context\FeatureContext::visit()
Then I should see a "#fos_comment_thread[data-thread=test]" element # FOS\CommentBundle\Features\Context\FeatureContext::assertElementOnPage()
<?php
/**
* @ORM\Entity
* @ORM\Table(name="capability")
*/
class Capability
{
/**
* @ORM\Column(type="integer")
@merk
merk / GroupManager.php
Created March 22, 2012 02:37
ObjectManager/Manager service trait test. Allows multiple object Manager classes to use Doctrine's ObjectManager, rather than reimplementing the same functions again and again.
<?php
namespace Ibms\CustomerBundle\Entity;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ORM\QueryBuilder;
/**
* Manages Group objects.
*
services:
instant_mailer:
class: %swiftmailer.class%
argument:
- @swiftmailer.transport.real
@merk
merk / exception
Created March 2, 2012 03:56
composer failure
Fatal error: Cannot redeclare class Composer\Repository\InstalledFilesystemRepository in phar:///Users/tim/Sites/FOSCommentBundle/composer.phar/src/Composer/Repository/InstalledFilesystemRepository.php on line 2
Call Stack:
0.0030 707032 1. {main}() /Users/tim/Sites/FOSCommentBundle/composer.phar:0
0.0033 704888 2. require('phar:///Users/tim/Sites/FOSCommentBundle/composer.phar/bin/composer') /Users/tim/Sites/FOSCommentBundle/composer.phar:15
0.0100 1909272 3. Composer\Console\Application->run() phar:///Users/tim/Sites/FOSCommentBundle/composer.phar/bin/composer:13
0.0118 2175344 4. Symfony\Component\Console\Application->run() phar:///Users/tim/Sites/FOSCommentBundle/composer.phar/src/Composer/Console/Application.php:2
0.0127 2364568 5. Composer\Console\Application->doRun() phar:///Users/tim/Sites/FOSCommentBundle/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:2
0.0180 3291544 6. Symfony\Component\Console\Application->doR
@merk
merk / BBCode.php
Created March 1, 2012 09:50
BBCode parser for FOSCommentBundle
<?php
namespace Test\CommentBundle\Markup;
use FOS\CommentBundle\Markup\ParserInterface;
use HTMLPurifier;
class BBCode implements ParserInterface
{
private $parser;