<p>Looks like maybe you have an Assets field within a Matrix field, which has the dynamic subpath set to:</p>

<pre><code>{postDate.year}/{postDate.month}/
</code></pre>

<p>But as the error suggests, Matrix blocks don’t have post dates. They have an <a href="http://buildwithcraft.com/docs/templating/MatrixBlockModel#owner" rel="nofollow">owner</a>, though, and that owner will have a post date, if it's an entry. So you should use this instead:</p>

<pre><code>{owner.postDate.year}/{owner.postDate.month}/
</code></pre>

<p>or:</p>

<pre><code>{owner.postDate|date('Y/n')}/
</code></pre>

CC BY-SA 3.0
2014-09-05T23:04:30.627Z
Yep, you nailed it Brandon.  Using "owner." in the default dynamic subpath fixed the issue. The dynamic subpath is such an awesome feature for clients finding their assets & keeping them organized.  Thanks & have a great weekend!
Moto_Nomad
CC BY-SA 3.0
2014-09-05T22:46:23.600Z
2014-09-05T22:46:23.600Z
Brandon Kelly
<p>As of Craft 2.2 build 2579 / 2581  I get an error upon save for entires in a section that uses postDate in the URL and in the {slug}</p>

<blockquote>
  <p>CException  Craft\MatrixBlockModel and its behaviors do not have a
  method or closure named "postDate".</p>
</blockquote>

<p>Removing postDate from slug didn't eliminate error.  Also noticed that system wanted to change postDate in slug when editing older entries. </p>

<p>**Any possible work arounds for this? **</p>

<h2>--------------------------------------------------------</h2>

<hr>

<p><strong>/www/Sites/craft.dev/craft/app/framework/base/CComponent.php(266)</strong>    </p>

<blockquote>
  <p>266         throw new CException(Yii::t('yii','{class} and its behaviors do not have a method or closure named "{name}".',</p>
</blockquote>

<p><strong>Stack Trace</strong></p>

<pre><code>#0  
+  /www/Sites/craft.dev/craft/app/models/BaseModel.php(124): CComponent-&gt;__call("postDate", array())
#1  
 unknown(0): Craft\BaseModel-&gt;__call("postDate", array())
#2  
 unknown(0): Craft\MatrixBlockModel-&gt;postDate()
#3  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(461): call_user_func_array(array(Craft\MatrixBlockModel, "postDate"), array())
#4  
+  /www/Sites/craft.dev/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template-&gt;getAttribute(Craft\MatrixBlockModel, "postDate", array(), "any", ...)
#5  
+  /www/Sites/craft.dev/craft/storage/runtime/compiled_templates/30/9d/6b553941d52d3cfbc7a301dc2160dfce824fa19b6538fb3b0819c38d9211.php(19): Craft\BaseTemplate-&gt;getAttribute(Craft\MatrixBlockModel, "postDate")
#6  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_309d6b553941d52d3cfbc7a301dc2160dfce824fa19b6538fb3b0819c38d9211-&gt;doDisplay(array("object" =&gt; Craft\MatrixBlockModel, "craft" =&gt; Craft\CraftVariable, "blx" =&gt; Craft\CraftVariable, "now" =&gt; Craft\DateTime, ...), array())
#7  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template-&gt;displayWithErrorHandling(array("object" =&gt; Craft\MatrixBlockModel, "craft" =&gt; Craft\CraftVariable, "blx" =&gt; Craft\CraftVariable, "now" =&gt; Craft\DateTime, ...), array())
#8  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template-&gt;display(array("object" =&gt; Craft\MatrixBlockModel))
#9  
+  /www/Sites/craft.dev/craft/app/services/TemplatesService.php(309): Twig_Template-&gt;render(array("object" =&gt; Craft\MatrixBlockModel))
#10 
+  /www/Sites/craft.dev/craft/app/fieldtypes/AssetsFieldType.php(407): Craft\TemplatesService-&gt;renderObjectTemplate("{postDate.year}/{postDate.month}", Craft\MatrixBlockModel)
#11 
+  /www/Sites/craft.dev/craft/app/fieldtypes/AssetsFieldType.php(203): Craft\AssetsFieldType-&gt;_resolveSourcePathToFolderId("1", "{postDate.year}/{postDate.month}/")
#12 
+  /www/Sites/craft.dev/craft/app/services/ElementsService.php(1197): Craft\AssetsFieldType-&gt;onAfterElementSave()
#13 
+  /www/Sites/craft.dev/craft/app/services/MatrixService.php(701): Craft\ElementsService-&gt;saveElement(Craft\MatrixBlockModel, false)
#14 
+  /www/Sites/craft.dev/craft/app/services/MatrixService.php(802): Craft\MatrixService-&gt;saveBlock(Craft\MatrixBlockModel, false)
#15 
+  /www/Sites/craft.dev/craft/app/fieldtypes/MatrixFieldType.php(467): Craft\MatrixService-&gt;saveField(Craft\MatrixFieldType)
#16 
+  /www/Sites/craft.dev/craft/app/services/ElementsService.php(1197): Craft\MatrixFieldType-&gt;onAfterElementSave()
#17 
+  /www/Sites/craft.dev/craft/app/services/EntriesService.php(167): Craft\ElementsService-&gt;saveElement(Craft\EntryModel)
#18 
+  /www/Sites/craft.dev/craft/app/controllers/EntriesController.php(479): Craft\EntriesService-&gt;saveEntry(Craft\EntryModel)
#19 
+  /www/Sites/craft.dev/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController-&gt;actionSaveEntry()
#20 
+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(308): CInlineAction-&gt;runWithParams(array("p" =&gt; "admin/entries/daily/56-daily-edition-for-2014-5-19"))
#21 
+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(286): CController-&gt;runAction(CInlineAction)
#22 
+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(265): CController-&gt;runActionWithFilters(CInlineAction, null)
#23 
+  /www/Sites/craft.dev/craft/app/framework/web/CWebApplication.php(282): CController-&gt;run("saveEntry")
#24 
+  /www/Sites/craft.dev/craft/app/etc/web/WebApp.php(899): CWebApplication-&gt;runController("entries/saveEntry")
#25 
+  /www/Sites/craft.dev/craft/app/etc/web/WebApp.php(272): Craft\WebApp-&gt;_processActionRequest()
#26 
+  /www/Sites/craft.dev/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&gt;processRequest()
#27 
+  /www/Sites/craft.dev/craft/app/index.php(35): CApplication-&gt;run()
#28 
–  /Users/jball/Sites/craft.dev/public/index.php(14): require_once("/www/Sites/craft.dev/craft/app/index.php")
</code></pre>

<matrix><postdate>
CException Craft\MatrixBlockModel and its behaviors do not have a method or closure named "postDate"
# CException Craft\MatrixBlockModel and its behaviors do not have a method or closure named "postDate"

(Asked by: username_0 on 2014-09-05)

As of Craft 2.2 build 2579 / 2581  I get an error upon save for entires in a section that uses postDate in the URL and in the {slug}

CException  Craft\MatrixBlockModel and its behaviors do not have a
  method or closure named "postDate".

Removing postDate from slug didn't eliminate error.  Also noticed that system wanted to change postDate in slug when editing older entries. 
**Any possible work arounds for this? **
--------------------------------------------------------

/www/Sites/craft.dev/craft/app/framework/base/CComponent.php(266) 

266         throw new CException(Yii::t('yii','{class} and its behaviors do not have a method or closure named "{name}".',

Stack Trace
#0  
+  /www/Sites/craft.dev/craft/app/models/BaseModel.php(124): CComponent->__call("postDate", array())
#1  
 unknown(0): Craft\BaseModel->__call("postDate", array())
#2  
 unknown(0): Craft\MatrixBlockModel->postDate()
#3  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(461): call_user_func_array(array(Craft\MatrixBlockModel, "postDate"), array())
#4  
+  /www/Sites/craft.dev/craft/app/etc/templating/BaseTemplate.php(41): Twig_Template->getAttribute(Craft\MatrixBlockModel, "postDate", array(), "any", ...)
#5  
+  /www/Sites/craft.dev/craft/storage/runtime/compiled_templates/30/9d/6b553941d52d3cfbc7a301dc2160dfce824fa19b6538fb3b0819c38d9211.php(19): Craft\BaseTemplate->getAttribute(Craft\MatrixBlockModel, "postDate")
#6  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(279): __TwigTemplate_309d6b553941d52d3cfbc7a301dc2160dfce824fa19b6538fb3b0819c38d9211->doDisplay(array("object" => Craft\MatrixBlockModel, "craft" => Craft\CraftVariable, "blx" => Craft\CraftVariable, "now" => Craft\DateTime, ...), array())
#7  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(253): Twig_Template->displayWithErrorHandling(array("object" => Craft\MatrixBlockModel, "craft" => Craft\CraftVariable, "blx" => Craft\CraftVariable, "now" => Craft\DateTime, ...), array())
#8  
+  /www/Sites/craft.dev/craft/app/vendor/twig/twig/lib/Twig/Template.php(264): Twig_Template->display(array("object" => Craft\MatrixBlockModel))
#9  
+  /www/Sites/craft.dev/craft/app/services/TemplatesService.php(309): Twig_Template->render(array("object" => Craft\MatrixBlockModel))
#10 
+  /www/Sites/craft.dev/craft/app/fieldtypes/AssetsFieldType.php(407): Craft\TemplatesService->renderObjectTemplate("{postDate.year}/{postDate.month}", Craft\MatrixBlockModel)
#11 
+  /www/Sites/craft.dev/craft/app/fieldtypes/AssetsFieldType.php(203): Craft\AssetsFieldType->_resolveSourcePathToFolderId("1", "{postDate.year}/{postDate.month}/")
#12 
+  /www/Sites/craft.dev/craft/app/services/ElementsService.php(1197): Craft\AssetsFieldType->onAfterElementSave()
#13 
+  /www/Sites/craft.dev/craft/app/services/MatrixService.php(701): Craft\ElementsService->saveElement(Craft\MatrixBlockModel, false)
#14 
+  /www/Sites/craft.dev/craft/app/services/MatrixService.php(802): Craft\MatrixService->saveBlock(Craft\MatrixBlockModel, false)
#15 
+  /www/Sites/craft.dev/craft/app/fieldtypes/MatrixFieldType.php(467): Craft\MatrixService->saveField(Craft\MatrixFieldType)
#16 
+  /www/Sites/craft.dev/craft/app/services/ElementsService.php(1197): Craft\MatrixFieldType->onAfterElementSave()
#17 
+  /www/Sites/craft.dev/craft/app/services/EntriesService.php(167): Craft\ElementsService->saveElement(Craft\EntryModel)
#18 
+  /www/Sites/craft.dev/craft/app/controllers/EntriesController.php(479): Craft\EntriesService->saveEntry(Craft\EntryModel)
#19 
+  /www/Sites/craft.dev/craft/app/framework/web/actions/CInlineAction.php(49): Craft\EntriesController->actionSaveEntry()
#20 
+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(array("p" => "admin/entries/daily/56-daily-edition-for-2014-5-19"))
#21 
+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(286): CController->runAction(CInlineAction)
#22 
+  /www/Sites/craft.dev/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, null)
#23 
+  /www/Sites/craft.dev/craft/app/framework/web/CWebApplication.php(282): CController->run("saveEntry")
#24 
+  /www/Sites/craft.dev/craft/app/etc/web/WebApp.php(899): CWebApplication->runController("entries/saveEntry")
#25 
+  /www/Sites/craft.dev/craft/app/etc/web/WebApp.php(272): Craft\WebApp->_processActionRequest()
#26 
+  /www/Sites/craft.dev/craft/app/framework/base/CApplication.php(180): Craft\WebApp->processRequest()
#27 
+  /www/Sites/craft.dev/craft/app/index.php(35): CApplication->run()
#28 
–  /Users/jball/Sites/craft.dev/public/index.php(14): require_once("/www/Sites/craft.dev/craft/app/index.php")

**Tags:** matrix, postdate

---

## 1 answers

### Answer by username_1 on 2014-09-05. Score: 3 | Accepted answer

Looks like maybe you have an Assets field within a Matrix field, which has the dynamic subpath set to:
{postDate.year}/{postDate.month}/

But as the error suggests, Matrix blocks don’t have post dates. They have an owner, though, and that owner will have a post date, if it's an entry. So you should use this instead:
{owner.postDate.year}/{owner.postDate.month}/

or:
{owner.postDate|date('Y/n')}/

> **Comments:**
> **username_0**: Yep, you nailed it Brandon.  Using "owner." in the default dynamic subpath fixed the issue. The dynamic subpath is such an awesome feature for clients finding their assets & keeping them organized.  Thanks & have a great weekend!  

---

