Skip to content

Instantly share code, notes, and snippets.

View khepin's full-sized avatar

Sebastien Armand khepin

  • San Francisco, USA
View GitHub Profile
<?php
public function configure()
{
// not really useful, but just in case!
parent::configure();
$this->postConfigure();
}
public function postConfigure()
{
.required_form_field:after {
content:" *";
}
<?php
public function executeCreate(sfWebRequest $request)
{
$this->form = new SomeForm();
if($this->processForm($request, $this->form))
{
return $this->renderPartial('list', array(
'my_partial' => $this->form->getObject()
));
Student:
columns:
name: string(255)
Test:
columns:
month: string(10)
mark: integer
student_id: integer
relations:
Student:
john:
name: John
michael:
name: Michael
jane:
name: Jane
linda:
name: Linda
<?php
public function executeIndex(sfWebRequest $request)
{
$this->students = StudentTable::getInstance()->findAll();
}
excel:
url: /a.:sf_format
param: { module: excel, action: index }
request:
param:
formats:
xls: application/vnd.ms-excel
pdf: application/pdf
ods: application/vnd.oasis.opendocument.spreadsheet
<?php
require_once dirname(__FILE__).'/../lib/vendor/symfony/lib/autoload/sfCoreAutoload.class.php';
sfCoreAutoload::register();
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enablePlugins('sfDoctrinePlugin');
<?php
class MyExcel {
private static $format = '';
private static $acceptedFormats = array('ods', 'xls', 'pdf');
public static function setFormat(sfEvent $event) {
self::$format = $event['format'];
}