diff --git a/modules/cms/classes/CmsObject.php b/modules/cms/classes/CmsObject.php index acdd0f3ac..d6451a0fc 100644 --- a/modules/cms/classes/CmsObject.php +++ b/modules/cms/classes/CmsObject.php @@ -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); } /** diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index faa52da07..b92bb4a99 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -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; /**