Returns original setter functionality
To protected things like $this->page->title = "foo"; Template -> Bracket
This commit is contained in:
parent
aaff88b8c2
commit
07132ffbd6
|
|
@ -446,7 +446,7 @@ class CmsObject extends Extendable implements ArrayAccess
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the absolute file path.
|
||||
* @param $theme Specifies a theme the file belongs to.
|
||||
|
|
@ -488,6 +488,23 @@ class CmsObject extends Extendable implements ArrayAccess
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an attribute on the object.
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function __set($key, $value)
|
||||
{
|
||||
$methodName = 'set'.ucfirst($key);
|
||||
if (method_exists($this, $methodName)) {
|
||||
$this->$methodName($value);
|
||||
}
|
||||
// Do not allow setting protected properties
|
||||
elseif (!property_exists($this, $key)) {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given attribute exists.
|
||||
* @param mixed $offset
|
||||
|
|
@ -558,8 +575,7 @@ class CmsObject extends Extendable implements ArrayAccess
|
|||
return call_user_func_array(array($query, $method), $parameters);
|
||||
}
|
||||
|
||||
$className = get_class($this);
|
||||
throw new \BadMethodCallException("Call to undefined method {$className}::{$method}()");
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use October\Rain\Exception\AjaxException;
|
|||
use October\Rain\Exception\SystemException;
|
||||
use October\Rain\Exception\ValidationException;
|
||||
use October\Rain\Exception\ApplicationException;
|
||||
use October\Rain\Parse\Template as TextParser;
|
||||
use October\Rain\Parse\Bracket as TextParser;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue