Skip to content

Instantly share code, notes, and snippets.

View dantleech's full-sized avatar
💭
Nothing

dantleech dantleech

💭
Nothing
View GitHub Profile
@dantleech
dantleech / gist:827346
Created February 15, 2011 10:12
InheritanceField
// .. InheritableField.php
public function __construct($key, Field $field)
{
parent::__construct($key, array());
$this->setPropertyPath('inheritanceData');
$field->setKey('value');
$field->setPropertyPath(sprintf('[%s][value]', $key));
@dantleech
dantleech / gist:859499
Created March 7, 2011 23:25
More ideas on the Ylly table bundle
<?php
namespace Ylly\YllyBackOfficeBundle\Table;
use Ylly\YllyTableBundle\Table\Table;
class SiteManageTable extends Table
{
public function configure()
{
// CURRENT API
public function renderContent($contentBlockName)
{
$siteManager = $this->container->get('yprox.site.manager');
$contents = $siteManager->getContentByBlockName($contentBlockName);
$contentList = array();
foreach ($contents as $content) {
$extension = $this->container->get('yprox.extension_manager')->getExtension($content->getExtensionAlias());
$feature = $extension->getFeature($content->getFeatureName());
try {
daniel@dan-x220 ~/www/phpcr-odm/tests :( $ phpunit --group functional -c phpunit_doctrine_dbal.xml.dist Doctrine/Tests/
PHPUnit 3.7.10 by Sebastian Bergmann.
Configuration read from /home/daniel/www/phpcr-odm/tests/phpunit_doctrine_dbal.xml.dist
............................................................... 63 / 437 ( 14%)
...............................SS.FFF..FFF..F.................. 126 / 437 ( 28%)
......F..........................................SSSSSSSSSSSSS
Time: 55 seconds, Memory: 46.75Mb
@dantleech
dantleech / replace.sh
Created April 10, 2013 15:05
Exception message reformatting script
#!/bin/bash
FILES=`find ./src/Symfony -name "*.php"`
OPTS=-i.bak
git reset --hard
# Fix 'This is '.$an.' exception '.$ok.' foo '.$bar
perl $OPTS -pe "s/throw new (.*)Exception\('(.*?)'\.(.*?)\.'(.*?)'\.(.*?)\.'(.*?)'\.([^']*?)\);/throw new \1Exception\(sprintf\('\2%s\4%s\6%s', \3, \5, \7\)\);/g" $FILES
# Fix 'This is '.$an.' exception '.$ok
<symfony-cmf-blog:config>
<symfony-cmf-blog:dynamic>
<symfony-cmf-blog:controllers-by-class
Symfony\CmfBundle\BlogBundle\Document\Post="symfony_cmf_blog.blog_controller:listAction"
</symfony-cmf-blog:controllers-by-class>
</symfony-cmf-blog:dynamic/>
</symfony-cmf-blog:config>
@dantleech
dantleech / convert.php
Last active November 23, 2018 13:18
Script to convert symfony YAML translation file to XLIFF
<?php
// Script to convert Symfony YAML translation files to XLIFF.
//
// Will add a .xliff version of the given file in its directory.
//
// $ php convert.php path/to/MyBundle.en.yml
$file = $argv[1];
@dantleech
dantleech / phpcr_query.php
Last active December 20, 2015 08:09
Example of advanced phpcr query
<?php
// ******** ODM Iteration 4 - Proposed ********
// Fluid interface.
//
// This illustrates the "broken" style, you could equally do
// the entire thing fluently using "end()" methods.
//
// 20 lines
@dantleech
dantleech / gist:6452511
Last active December 22, 2015 09:29 — forked from anonymous/gist:6452479

Method by method

n/c = no change

In general I think I (and maybe lukas) agreed with dbu about talking about properties instead of fields as I think this consistent with mapping.

  • addJoinInner(): n/c
  • addJoinLeftOuter(): n/c
  • addJoinRightOuter(): n/c
protected function getDoctrine_Dbal_DefaultConnectionService()
{
$a = new \Doctrine\DBAL\Logging\LoggerChain();
$a->addLogger(new \Symfony\Bridge\Doctrine\Logger\DbalLogger($this->get('monolog.logger.doctrine'), $this->get('debug.stopwatch')));
$a->addLogger($this->get('doctrine.dbal.logger.profiling.default'));
$b = new \Doctrine\DBAL\Configuration();
$b->setSQLLogger($a);
$c = new \Gedmo\Timestampable\TimestampableListener();