sfFormPropel is the base class for forms based on Propel objects.
Inheritence
sfFormPropel
<
sfForm
Method Summary
-
Boolean
bindAndSave($taintedValues, $taintedFiles = null, (PropelPDO) $con = null)
Binds the current form and save the to the database in one step.
-
camelize($text)
-
doSave((PropelPDO) $con = null)
Updates and saves the current object.
-
embedI18n($cultures, $decorator = null)
Embeds i18n objects into the current form.
-
PropelPDO
getConnection()
Returns the default connection for the current model.
-
string
getI18nFormClass()
Returns the name of the i18n form class.
-
string
getI18nModelName()
Returns the name of the i18n model.
-
getModelName()
Returns the current model name.
-
BaseObject
getObject()
Returns the current object for this form.
-
Boolean
isI18n()
Returns true if the current form has some associated i18n objects.
-
Boolean
isNew()
Returns true if the current form embeds a new object.
-
string
processUploadedFile($field, $filename = null, $values = null)
Saves the uploaded file for the given field.
-
array
processValues($values)
Processes cleaned up values with user defined methods.
-
removeFile($field)
Removes the current file for the field.
-
string
renderFormTag($url, $attributes = array())
Renders a form tag suitable for the related Propel object.
-
BaseObject
save((PropelPDO) $con = null)
Saves the current object to the database.
-
saveEmbeddedForms((PropelPDO) $con = null, $forms = null)
Saves embedded form objects.
-
string
saveFile($field, $filename = null, $file = null)
Saves the current file for the field.
-
updateDefaultsFromObject()
Updates the default values of the form with the current values of the
current object.
-
BaseObject
updateObject($values = null)
Updates the values of the object with the cleaned up values.
-
updateObjectEmbeddedForms($values, $forms = null)
Updates the values of the objects in embedded forms.
-
__construct($object = null, $options = array(), $CSRFSecret = null)
Constructor.
Methods inherited from sfForm
addCSRFProtection , bind , configure , convertFileInformation , count , current , deepArrayUnion , disableCSRFProtection , embedForm , embedFormForEach , enableCSRFProtection , fixPhpFilesArray , getCSRFFieldName , getCSRFToken , getDefault , getDefaults , getEmbeddedForms , getErrorSchema , getFormFieldSchema , getGlobalErrors , getJavaScripts , getName , getOption , getStylesheets , getTaintedValues , getToStringException , getValidator , getValidatorSchema , getValue , getValues , getWidget , getWidgetSchema , hasDefault , hasErrors , hasGlobalErrors , hasToStringException , isBound , isCSRFProtected , isMultipart , isValid , key , mergeForm , mergePostValidator , mergePreValidator , next , offsetExists , offsetGet , offsetSet , offsetUnset , render , renderFormTag , renderGlobalErrors , renderHiddenFields , renderUsing , resetFormFields , rewind , setCSRFFieldName , setDefault , setDefaults , setOption , setToStringException , setup , setValidator , setValidators , setValidatorSchema , setWidget , setWidgets , setWidgetSchema , valid , __clone , __construct , __toString
Method Details
-
(Boolean) bindAndSave ($taintedValues, $taintedFiles = null, (PropelPDO) $con = null)
Browse code
| $taintedValues |
An array of tainted values to use to bind the form
|
| $taintedFiles |
An array of uploaded files (in the $_FILES or $_GET format)
|
| $con |
An optional PropelPDO object
|
Binds the current form and save the to the database in one step.
returns true if the form is valid, false otherwise
-
-
doSave ((PropelPDO) $con = null)
Browse code
| $con |
An optional PropelPDO object
|
Updates and saves the current object.
If you want to add some logic before saving or save other associated objects, this is the method to override.
-
embedI18n ($cultures, $decorator = null)
Browse code
| $cultures |
An array of cultures
|
| $decorator |
A HTML decorator for the embedded form
|
Embeds i18n objects into the current form.
-
(PropelPDO) getConnection ()
Browse code
Returns the default connection for the current model.
returns A database connection
-
(string) getI18nFormClass ()
Browse code
Returns the name of the i18n form class.
returns The name of the i18n form class
-
(string) getI18nModelName ()
Browse code
Returns the name of the i18n model.
returns The name of the i18n model
-
Returns the current model name.
-
(BaseObject) getObject ()
Browse code
Returns the current object for this form.
returns The current object.
-
Returns true if the current form has some associated i18n objects.
returns true if the current form has some associated i18n objects, false otherwise
-
Returns true if the current form embeds a new object.
returns true if the current form embeds a new object, false otherwise
-
(string) processUploadedFile ($field, $filename = null, $values = null)
Browse code
| $field |
The field name
|
| $filename |
The file name of the file to save
|
| $values |
An array of values
|
Saves the uploaded file for the given field.
returns The filename used to save the file
-
(array) processValues ($values)
Browse code
| $values |
An array of values
|
Processes cleaned up values with user defined methods.
To process a value before it is used by the updateObject() method, you need to define an updateXXXColumn() method where XXX is the PHP name of the column. The method must return the processed value or false to remove the value from the array of cleaned up values.
returns An array of cleaned up values processed by the user defined methods
-
Removes the current file for the field.
-
(string) renderFormTag ($url, $attributes = array())
Browse code
| $url |
The URL for the action
|
| $attributes |
An array of HTML attributes
|
Renders a form tag suitable for the related Propel object.
The method is automatically guessed based on the Propel object: * if the object is new, the method is POST * if the object already exists, the method is PUT
returns An HTML representation of the opening form tag
-
(BaseObject) save ((PropelPDO) $con = null)
Browse code
| $con |
An optional PropelPDO object
|
Saves the current object to the database.
The object saving is done in a transaction and handled by the doSave() method. If the form is not valid, it throws an sfValidatorError.
returns The current saved object
-
saveEmbeddedForms ((PropelPDO) $con = null, $forms = null)
Browse code
| $con |
An optional PropelPDO object
|
| $forms |
An array of forms
|
Saves embedded form objects.
-
(string) saveFile ($field, $filename = null, $file = null)
Browse code
| $field |
The field name
|
| $filename |
The file name of the file to save
|
| $file |
The validated file to save
|
Saves the current file for the field.
returns The filename used to save the file
-
updateDefaultsFromObject ()
Browse code
Updates the default values of the form with the current values of the
current object.
-
(BaseObject) updateObject ($values = null)
Browse code
| $values |
An array of values
|
Updates the values of the object with the cleaned up values.
returns The current updated object
-
updateObjectEmbeddedForms ($values, $forms = null)
Browse code
| $values |
An array of values
|
| $forms |
An array of forms
|
Updates the values of the objects in embedded forms.
-
__construct ($object = null, $options = array(), $CSRFSecret = null)
Browse code
| $object |
A Propel object used to initialize default values
|
| $options |
An array of options
|
| $CSRFSecret |
A CSRF secret (false to disable CSRF protection, null to use the global
CSRF secret)
|
Constructor.
|