sfFormDoctrine is the base class for forms based on Doctrine objects.
Method Summary
-
doUpdateObject()
@see sfFormObject
-
embedI18n($cultures, $decorator)
Embeds i18n objects into the current form.
-
embedRelation($relationName, $formClass, $formArguments, $innerDecorator, $decorator)
Embed a Doctrine_Collection relationship in to a form
-
getConnection()
@return Doctrine_Connection
-
string
getI18nFormClass()
Returns the name of the i18n form class.
-
string
getI18nModelI18nField()
Returns the i18nField name of the i18n model.
-
string
getI18nModelName()
Returns the name of the i18n model.
-
string
getI18nModelPrimaryKeyName()
Returns the primary key name of the i18n model.
-
string
getRelatedModelName($alias)
Returns the name of the related model.
-
Boolean
isI18n()
Returns true if the current form has some associated i18n objects.
-
string
processUploadedFile($field, $filename, $values)
Saves the uploaded file for the given field.
-
processValues()
Processes cleaned up values with user defined methods.
-
removeFile($field)
Removes the current file for the field.
-
string
saveFile($field, $filename, $file)
Saves the current file for the field.
-
setupInheritance()
Used in generated forms when models use inheritance.
-
updateDefaultsFromObject()
Updates the default values of the form with the current values of the current object.
-
__construct(, , )
Constructor.
bindAndSave , camelize , doSave , doUpdateObject , getConnection , getModelName , getObject , isNew , processValues , renderFormTag , save , saveEmbeddedForms , updateObject , updateObjectEmbeddedForms
Method Details
-
@see sfFormObject
-
embedI18n ($cultures, $decorator)
Browse code
| $cultures |
An array of cultures |
| $decorator |
A HTML decorator for the embedded form |
Embeds i18n objects into the current form.
-
embedRelation ($relationName, $formClass, $formArguments, $innerDecorator, $decorator)
Browse code
| $relationName |
The name of the relation and an optional alias |
| $formClass |
The name of the form class to use |
| $formArguments |
Arguments to pass to the constructor (related object will be shifted onto the front) |
| $innerDecorator |
A HTML decorator for each embedded form |
| $decorator |
A HTML decorator for the main embedded form |
Embed a Doctrine_Collection relationship in to a form
[php]
$userForm = new UserForm($user);
$userForm->embedRelation('Groups AS groups');
throws InvalidArgumentException If the relationship is not a collection
-
@return Doctrine_Connection
-
(string) getI18nFormClass ()
Browse code
Returns the name of the i18n form class.
returns The name of the i18n form class
-
(string) getI18nModelI18nField ()
Browse code
Returns the i18nField name of the i18n model.
returns The i18nField name of the i18n model
-
(string) getI18nModelName ()
Browse code
Returns the name of the i18n model.
returns The name of the i18n model
-
(string) getI18nModelPrimaryKeyName ()
Browse code
Returns the primary key name of the i18n model.
returns The primary key name of the i18n model
-
(string) getRelatedModelName ($alias)
Browse code
Returns the name of the related model.
throws InvalidArgumentException If no relation with the supplied alias exists on the current model
-
Returns true if the current form has some associated i18n objects.
returns true if the current form has some associated i18n objects, false otherwise
-
(string) processUploadedFile ($field, $filename, $values)
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
-
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.
-
Removes the current file for the field.
-
(string) saveFile ($field, $filename, $file)
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
-
Used in generated forms when models use inheritance.
-
updateDefaultsFromObject ()
Browse code
Updates the default values of the form with the current values of the current object.
-
Constructor.
|