Skip to content

Instantly share code, notes, and snippets.

View pborreli's full-sized avatar

Pascal Borreli pborreli

View GitHub Profile
<?php
/**
The modifications to this class caches in APC all the file system scans that symfony does to find plugins paths, configurations files, modules, etc.
**/
class frontendConfiguration extends sfApplicationConfiguration
{
@pborreli
pborreli / Configuration.class.php
Created April 28, 2010 17:01
adding ":" to all labels and "*" to all required fields inside symfony 1.3+ forms
<?php
class privateConfiguration extends sfApplicationConfiguration
{
public function configure()
{
$this->dispatcher->connect('form.post_configure', array($this, 'listenToFormPostConfigure'));
}
/**
@pborreli
pborreli / import
Created May 10, 2010 14:42
Dealing with mass import in doctrine/pdo using pcntl_fork
<?php
class importTask extends sfTask
{
protected function execute($arguments = array(), $options = array())
{
$xml = simplexml_load_file('file');
$users = array();
foreach ($xml->users as $user)
{
@pborreli
pborreli / *Configuration.class.php
Created September 1, 2010 15:52
removing admin gen css files at app/project level
<?php
class privateConfiguration extends sfApplicationConfiguration {
public function configure() {
$this->dispatcher->connect('view.configure_format', array($this, 'listenToViewConfigureFormatEvent'));
}
@pborreli
pborreli / Configuration.class.php
Created September 13, 2010 16:12
how to replace a specific widget by another for all generated forms in symfony
<?php
class xxxConfiguration extends sfXxxConfiguration
{
public function setup()
{
$this->dispatcher->connect('command.filter_options', array($this, 'filterCommandOptions'));
}
@pborreli
pborreli / Configuration.class.php
Created September 14, 2010 18:29
how to remove "with_empty" checkbox for all generated formFilters in symfony 1.4
<?php
class xxxConfiguration extends sfXxxConfiguration
{
public function setup()
{
$this->dispatcher->connect('command.filter_options', array($this, 'filterCommandOptions'));
}
@pborreli
pborreli / ProjectConfiguration.class.php
Created September 16, 2010 11:23
disable drop-db task in symfony console
<?php
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->dispatcher->connect('command.filter_options', array($this, 'filterCommandOptions'));
}
/**
@pborreli
pborreli / ProjectConfiguration.class.php
Created September 16, 2010 11:54
force drop of one specific database symfony
<?php
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->dispatcher->connect('command.filter_options', array($this, 'filterCommandOptions'));
}
/**
<?php
mysql_connect('localhost', 'root', '') or
die('cannot connect : ' . mysql_error());
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
body { font-family: arial, helvetica, sans-serif; font-size: 10pt; margin: 0; }
table { border-collapse: collapse; margin: auto; }
<h1>[?php echo <?php echo '$barfoo->getValue()' ?> ?]</h1>
// will produce
<h1><?php echo $barfoo->getValue() ?></h1>