getModelArrayAttribute -> resolveModelAttribute

This commit is contained in:
Samuel Georges 2015-01-05 11:18:43 +11:00
parent d91d4112a5
commit 5d2a177646
4 changed files with 7 additions and 7 deletions

View File

@ -103,7 +103,7 @@ abstract class FormWidgetBase extends WidgetBase
*/
public function getLoadValue()
{
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
if (!is_null($model)) {
return $model->{$attribute};
@ -115,11 +115,11 @@ abstract class FormWidgetBase extends WidgetBase
/**
* Returns the final model and attribute name of
* a nested HTML array attribute.
* Eg: list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
* Eg: list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
* @param string $attribute.
* @return array
*/
public function getModelArrayAttribute($attribute)
public function resolveModelAttribute($attribute)
{
$model = $this->model;
$parts = Str::evalHtmlArray($attribute);

View File

@ -109,7 +109,7 @@ class FileUpload extends FormWidgetBase
*/
protected function getRelationObject()
{
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
return $model->{$attribute}();
}
@ -120,7 +120,7 @@ class FileUpload extends FormWidgetBase
*/
protected function getRelationType()
{
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
return $model->getRelationType($attribute);
}

View File

@ -130,7 +130,7 @@ class RecordFinder extends FormWidgetBase
public function onRefresh()
{
list($model, $attribute) = $this->getModelArrayAttribute($this->valueFrom);
list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);
$model->{$attribute} = post($this->formField->getName());
$this->prepareVars();

View File

@ -104,7 +104,7 @@ class Relation extends FormWidgetBase
$field = clone $this->formField;
list($model, $attribute) = $this->getModelArrayAttribute($this->relationName);
list($model, $attribute) = $this->resolveModelAttribute($this->relationName);
$relatedObj = $model->makeRelation($attribute);
$query = $model->{$attribute}()->newQuery();