Public Member Functions | |
__construct (RedBeanModel $model) | |
getModel () | |
__toString () | |
__set ($name, $value) | |
__get ($name) | |
getMetadata () | |
isAttribute ($attributeName) | |
isAttributeRequired ($attribute) | |
attributeNames () | |
getAttributeLabel ($attribute) | |
setAttributes ($values, $safeOnly=true) | |
validate ($attributes=null, $clearErrors=true) | |
getValidators ($attribute=null) | |
getErrors ($attributeNameOrNames=null) | |
hasErrors ($attributeNameOrNames=null) | |
save ($runValidation=true, array $attributeNames=null) | |
getError ($attribute) | |
Static Public Member Functions | |
static | isOwnedRelation ($attributeName) |
static | isRelation ($attributeName) |
static | getRelationModelClassName ($relationName) |
Static Protected Member Functions | |
static | getRedBeanModelClassName () |
static | shouldIgnoreRequiredValidator () |
Protected Attributes | |
$model | |
Provides an interface that is the same as a RedBeanModel interface, but allows developer to extend RedBeanModel with additional attributes that are not part of the model.
Definition at line 42 of file ModelForm.php.
|
staticprotected |
Override in child to implement.
NotImplementedException |
Definition at line 52 of file ModelForm.php.
getMetadata | ( | ) |
Interface to mimic model getMetadata method. Can only be called non-statically since the model is required.
Definition at line 97 of file ModelForm.php.
|
static |
If the attribute exists on the form, then assume it is not a relation since the form does not support relational attributes.
Definition at line 106 of file ModelForm.php.
|
static |
If the attribute exists on the form, then assume it is not a relation since the form does not support relational attributes.
Definition at line 120 of file ModelForm.php.
|
static |
If the attribute exists on the form, then assume it is not a relation since the form does not support relational attributes.
Definition at line 134 of file ModelForm.php.
isAttribute | ( | $attributeName | ) |
Returns true if the named attribute is a property on this model.
Definition at line 148 of file ModelForm.php.
isAttributeRequired | ( | $attribute | ) |
Override to properly check if the attribute is required or not. (non-PHPdoc)
Definition at line 164 of file ModelForm.php.
attributeNames | ( | ) |
Returns the list of attribute names. By default, this method returns all public properties of the class. You may override this method to change the default.
Definition at line 179 of file ModelForm.php.
setAttributes | ( | $values, | |
$safeOnly = true |
|||
) |
Override of setAttributes in CModel to support setting attributes into this form as well as the related model. Splits $values into two arrays. First array is name/value pairs of attributes on this form, whereas the second array is name/value pairs on the model.
Definition at line 219 of file ModelForm.php.
validate | ( | $attributes = null , |
|
$clearErrors = true |
|||
) |
Performs validation on this form and the model. clearErrors is not supported, because the model does not support this parameter in the RedBeanModel->validate() function. Currently this method does not support specifying the $attributes parameter.
Definition at line 244 of file ModelForm.php.
getValidators | ( | $attribute = null | ) |
Override to properly get validators for an attribute when they are on the model. Todo: Factor in scenario for model attributes. (non-PHPdoc)
Definition at line 263 of file ModelForm.php.
|
staticprotected |
Override and set to true if you need to ignore the required validator.
Definition at line 275 of file ModelForm.php.
getErrors | ( | $attributeNameOrNames = null | ) |
Return array of errors on form and model. Currently this method does not support specifying the $attributeNameOrNames parameter.
Definition at line 284 of file ModelForm.php.
hasErrors | ( | $attributeNameOrNames = null | ) |
Definition at line 295 of file ModelForm.php.
save | ( | $runValidation = true , |
|
array | $attributeNames = null |
||
) |
Saves the model.
Definition at line 308 of file ModelForm.php.
getError | ( | $attribute | ) |
Override to fix the defect where modelform consist of a model whose attributes are displayed on the form.
string | $attribute | attribute name. |
Definition at line 324 of file ModelForm.php.