This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseDoctrineForm extends sfFormDoctrine | |
{ | |
public function __construct($object = null, $options = array(), $CSRFSecret = null) | |
{ | |
parent::__construct($object, $options, $CSRFSecret); | |
// tell the widget schema which fields are required | |
$this->widgetSchema->addOption('required_fields', $this->getRequiredFields()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseDoctrineForm extends sfFormDoctrine | |
{ | |
public function __construct($object = null, $options = array(), $CSRFSecret = null) | |
{ | |
parent::__construct($object, $options, $CSRFSecret); | |
// tell the widget schema which fields are required | |
$this->widgetSchema->addOption( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseDoctrineForm extends sfFormDoctrine | |
{ | |
// ... | |
protected function getRequiredFields(sfValidatorSchema $validatorSchema = null, | |
$format = null) | |
{ | |
if (is_null($validatorSchema)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RequiredLabelsFormatterTable extends sfWidgetFormSchemaFormatterTable | |
{ | |
protected | |
$requiredLabelClass = 'required'; | |
public function generateLabel($name, $attributes = array()) | |
{ | |
// loop up to find the "required_fields" option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BaseDoctrineForm extends sfFormDoctrine | |
{ | |
public function __construct($object = null, $options = array(), $CSRFSecret = null) | |
{ | |
// ... | |
$this->widgetSchema->addFormFormatter('table', | |
new RequiredLabelsFormatterTable($this->widgetSchema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$username = $argv[1]; | |
$password = $argv[2]; | |
// copied from http://fabien.potencier.org/article/20/tweeting-from-php | |
$context = stream_context_create(array( | |
'http' => array( | |
'method' => 'POST', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Doctrine/DataDict/Mysql.php | |
if ($length <= 1) { | |
return 'TINYINT'; | |
} elseif ($length == 2) { | |
return 'SMALLINT'; | |
} elseif ($length == 3) { | |
return 'MEDIUMINT'; | |
} elseif ($length == 4) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// config/ProjectConfiguration.class.php | |
class ProjectConfiguration extends sfProjectConfiguration | |
{ | |
protected | |
$masterConnection = null, | |
$slaveConnection = null; | |
public function initializeConnections() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class ConnectionListener extends Doctrine_Connection | |
implements Doctrine_EventListener_Interface | |
{ | |
protected | |
$master = null, | |
$slave = null; | |
public function __construct(PDO $master, PDO $slave) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// config/ProjectConfiguration.class.php | |
class ProjectConfiguration extends sfProjectConfiguration | |
{ | |
// ... | |
public function configureDoctrineConnection(Doctrine_Connection $conn) | |
{ | |
$listener = new ConnectionListener( |
OlderNewer