diff --git a/modules/cms/classes/CmsObject.php b/modules/cms/classes/CmsObject.php index c575910b3..e4f1b5e21 100644 --- a/modules/cms/classes/CmsObject.php +++ b/modules/cms/classes/CmsObject.php @@ -62,7 +62,7 @@ class CmsObject implements ArrayAccess /** * Creates an instance of the object and associates it with a CMS theme. * @param \Cms\Classes\Theme $theme Specifies the theme the object belongs to. - * If the theme is specified as NULL, then a query can be performed on the object. + * If the theme is specified as NULL, then a query can be performed on the object directly. */ public function __construct(Theme $theme = null) { @@ -492,7 +492,7 @@ class CmsObject implements ArrayAccess */ public function newQuery() { - $query = new CmsObjectQuery($this); + $query = new CmsObjectQuery($this, $this->theme); return $query; } @@ -504,8 +504,8 @@ class CmsObject implements ArrayAccess */ public function __call($method, $parameters) { - // If this object is populated with a theme, then a query - // cannot be performed on it to reduce overhead. + // If this object is populated with a theme, then a query + // cannot be performed on it to reduce overhead on populated objects. if (!$this->theme) { $query = $this->newQuery(); return call_user_func_array(array($query, $method), $parameters); diff --git a/modules/cms/classes/CmsObjectQuery.php b/modules/cms/classes/CmsObjectQuery.php index 40f49a4a9..69f0df865 100644 --- a/modules/cms/classes/CmsObjectQuery.php +++ b/modules/cms/classes/CmsObjectQuery.php @@ -17,9 +17,10 @@ class CmsObjectQuery protected $theme; - public function __construct($cmsObject) + public function __construct($cmsObject, $theme = null) { $this->cmsObject = $cmsObject; + $this->theme = $theme; } /**