Skip to content

Instantly share code, notes, and snippets.

@johnkary
Created June 13, 2011 16:00
Show Gist options
  • Save johnkary/1023061 to your computer and use it in GitHub Desktop.
Save johnkary/1023061 to your computer and use it in GitHub Desktop.
Concrete form to store widget value for "tenure_years" in key-value store
<?php
class MyForm extends BaseDoctrineForm
{
public function setup()
{
//tenure_years, integer
$this->widgetSchema['tenure_years'] = new sfWidgetFormInputText();
$this->validatorSchema['tenure_years'] = new sfValidatorInteger(array('required' => false));
}
/**
* @see KeyValueStoreForm
*/
protected function getObjectKeyValueStoreValues()
{
$values = array();
$values['tenure_years'] = $this->getObject()->aGet('tenure_years');
return $values;
}
/**
* @see KeyValueStoreForm
*/
protected function updateObjectKeyValueStoreValues(array $values)
{
$this->getObject()->aSet('tenure_years', $values['tenure_years']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment