Skip to content

Instantly share code, notes, and snippets.

View hartym's full-sized avatar
👽
Crafting great software

Romain Dorgueil hartym

👽
Crafting great software
View GitHub Profile
<?php
echo '<pre>';
print_r(sfContext::getInstance()->getUser()->getAttributeHolder()->getAll());
echo '</pre>';
die();
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
FileETag none
<IfModule mod_headers.c>
Header set Expires "Thu, 15 Apr 2015 20:00:00 GMT"
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "modification plus 10 years"
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
FileETag none
<IfModule mod_headers.c>
Header set Expires "Thu, 15 Apr 2015 20:00:00 GMT"
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "modification plus 10 years"
<?php
class myForm extends sfFormDoctrine
{
public function processValues($values = null)
{
$values = parent::processValues($values);
// calculate the value of virtual field "foo"
$values['foo'] = $foo;
return $values;
$result = $this
->createQuery('r')
->select('r.*, e.*')
->from('BookingResource r')
->leftJoin(
'r.Entries e ON '.
'( ( e.ending_at > :start AND e.ending_at <= :end ) OR '.
' ( e.starting_at < :end AND e.starting_at >= :start ) OR '.
' ( e.starting_at < :start AND e.ending_at > :end ) )'
)
// WITH SPACE: BUGGY
$result = $this
->createQuery('r')
->select('r.*, e.*')
->from('BookingResource r')
->leftJoin(
'r.Entries e ON '.
'( r.id = e.resource_id AND '.
'( ( e.ending_at > :start AND e.ending_at <= :end ) OR '.
--- Buggy SQL:
SELECT c.id AS c__id, c.category_id AS c__category_id, c.name AS c__name, c.description AS c__description, c.need_validation_flag AS c__need_validation_flag, c.advertise_flag AS c__advertise_flag, c.created_at AS c__created_at, c.updated_at AS c__updated_at, c.slug AS c__slug, c2.id AS c2__id, c2.user_id AS c2__user_id, c2.resource_id AS c2__resource_id, c2.validator_id AS c2__validator_id, c2.information AS c2__information, c2.status AS c2__status, c2.visible_details_flag AS c2__visible_details_flag, c2.validated_at AS c2__validated_at, c2.starting_at AS c2__starting_at, c2.ending_at AS c2__ending_at, c2.created_at AS c2__created_at, c2.updated_at AS c2__updated_at FROM booking_resource c LEFT JOIN booking_entry c2 ON (c.id = c2.resource_id AND ((c2.ending_at > '1242691200' AND c2.ending_at <=) OR (c2.starting_at < '1245369600' AND c2.starting_at >= '1242691200') OR (c2.starting_at < '1242691200' AND c2.ending_at >))) WHERE c.category_id = '1' ORDER BY c2.starting_at
--- Good SQL:
SELEC
<?php
class Doctrine_Ticket_9999_TestCase extends Doctrine_UnitTestCase
{
public function prepareTables()
{
$this->tables[] = "Model1";
$this->tables[] = "Model2";
parent::prepareTables();
}
GOOD ONE:
Array
(
[0] => m2.id
[1] => =
[2] => m1.m2_id
)
WRONG ONE:
Index: lib/Doctrine/Cli.php
===================================================================
--- lib/Doctrine/Cli.php (revision 5937)
+++ lib/Doctrine/Cli.php (working copy)
@@ -21,7 +21,7 @@
/**
* Command line interface class
- * Interface for easily executing Doctrine_Task classes from a
+ * Interface for easily executing Doctrine_Task classes from a