Statamic: Call to a member function dated()
Call to a member function dated() on null
being thrown on a site migration and how to fix it.
Mike Griffiths
I recently migrated a Statamic site to a new server. The migration was automated, and involved a full disk image copy from server A to server B, so everything should have been the same on the new hardware. Except it wasn't.
The statamic site in question was throwing the following error on all page loads:
production.ERROR: Call to a member function dated() on null {"exception":"[object] (Error(code: 0): Call to a member function dated() on null at /home/***/vendor/statamic/cms/src/Stache/Stores/CollectionEntriesStore.php:85)
I'm not actually sure what the cause of this was, but the fix was to re-run my deployment script. My deployment script runs a bunch of commands, but the likely fix was flushing the cache.