Skip to content

Instantly share code, notes, and snippets.

View fzaninotto's full-sized avatar

Francois Zaninotto fzaninotto

View GitHub Profile
Index: Y:/symfony/1.3/lib/plugins/sfPropelPlugin/lib/debug/sfWebDebugPanelPropel.class.php
===================================================================
--- Y:/symfony/1.3/lib/plugins/sfPropelPlugin/lib/debug/sfWebDebugPanelPropel.class.php (revision 22519)
+++ Y:/symfony/1.3/lib/plugins/sfPropelPlugin/lib/debug/sfWebDebugPanelPropel.class.php (working copy)
@@ -44,7 +44,7 @@
$this->formatSql(htmlspecialchars($log, ENT_QUOTES, sfConfig::get('sf_charset')))
);
}
-
+
<?php
// syntax 1: condition/combine
$books = PropelQuery::from('Book')
->condition('cond1', 'Book.Title = ?', 'War And Peace') // create a condition named 'cond1'
->condition('cond2', 'Book.Title LIKE ?', 'War%') // create a condition named 'cond2'
->combine(array('cond1', 'cond2'), 'or', 'cond12') // create a condition named 'cond12' from 'cond1' and 'cond2'
->condition('cond3', 'Book.PublishedAt <= ?', $end) // create a condition named 'cond3'
->condition('cond4', 'Book.PublishedAt >= ?', $begin) // create a condition named 'cond4'
->combine(array('cond3', 'cond4'), 'and', 'cond34') // create a condition named 'cond34' from 'cond3' and 'cond4'
->where(array('cond12', 'cond34'), 'and') // combine the two conditions in a where
<?php
/**
* Base class that represents a row from the 'user' table.
*
*
*
* @package propel.generator.many2many.om
*/
abstract class BaseUser extends BaseObject implements Persistent
@echo off
rem *********************************************************************
rem ** The Propel generator convenience script for Windows based systems
rem ** $Id$
rem *********************************************************************
rem This script will do the following:
rem - check for PHING_COMMAND env, if found, use it.
rem - if not found detect php, if found use it, otherwise err and terminate
<pre><code>&lt;database name="my_connection_name" defaultIdMethod="native"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://www.propelorm.org/xsd/1.5/database.xsd" &gt;
</code></pre>
<?php
class AggregateColumnBehavior extends Behavior
{
// default parameters value
protected $parameters = array(
'name' =>; null,
);
}
@fzaninotto
fzaninotto / gist:671706
Created November 10, 2010 23:12
diff for phing's phpunit formatters to make cli output nicer in phinh 2.3.3
diff --git a/phpunit3/PlainPHPUnit3ResultFormatter.php b/phpunit3/PlainPHPUnit3ResultFormatter.php
index f2997aa..a671670 100644
--- a/phpunit3/PlainPHPUnit3ResultFormatter.php
+++ b/phpunit3/PlainPHPUnit3ResultFormatter.php
@@ -52,19 +52,13 @@ class PlainPHPUnit3ResultFormatter extends PHPUnit3ResultFormatter
function endTestSuite(PHPUnit_Framework_TestSuite $suite)
{
- $sb = "Testsuite: " . $suite->getName() . "\n";
- $sb.= "Tests run: " . $this->getRunCount();
<?php
// Propel way
$books = BookQuery::create()->find();
$xmlBooks = $books->toXml();
// Doctrine way
// $this is a symfony controller having access to the DIC
$em = $this->get('doctrine.orm.entity_manager');
$books = $em->createQuery('select b from \Acme\DemoBundle\Entity\Book b')->getResult();
@fzaninotto
fzaninotto / removeTrailingSpaces.php
Created April 6, 2011 19:19
Remove trailing spaces from PHP source files
<?php
$tests=array();
foreach (new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__,0|\RecursiveDirectoryIterator::SKIP_DOTS)), '/\.php$/') as $file) {
if (strpos((string) $file, '.svn')) {
continue;
}
$tests[] = realpath((string) $file);
}
foreach ($tests as $file) {
@fzaninotto
fzaninotto / gist:1292105
Created October 17, 2011 07:10
Faker first example
<?php
require_once '/path/to/Faker/src/Factory.php';
$faker = Faker\Factory::create(); // $faker is a Faker\Generator instance
echo $faker->name;
// 'Lucy Cechtelar';
echo $faker->address;
// "426 Jordy Lodge
// Cartwrightshire, SC 88120-6700"
echo $faker->lorem;