Skip to content

Instantly share code, notes, and snippets.

@pedroresende
Created November 20, 2012 15:39
Show Gist options
  • Save pedroresende/4118681 to your computer and use it in GitHub Desktop.
Save pedroresende/4118681 to your computer and use it in GitHub Desktop.
Stack Trace Error
$contentService = $this->repo->getContentService();
$location = $this->api->getLocationByPath( '/Date-and-Time-Test-Object' );
$content = $this->api->getContentToUpdate( $location->contentInfo );
try {
$newData = new DateTime( '31-09-2012 12:00 am' ); // 31-09-2012 12:00 am
$content->setField( 'date_time', $newData );
$this->api->saveContentUpdate( $content->contentInfo );
} catch (exception $e) {
echo "Exception trying to add and invalid date and time \n";
$newData = new DateTime( '30-09-2012 12:00 am' ); // 31-09-2012 12:00 am
$content->setField( 'date_time', $newData );
$this->api->saveContentUpdate( $content->contentInfo );
}
$this->api->clearViewCacheByPath( '/' ); // Workaround for bug #019637 : publicAPI : View cache is not cleared when making a new version of an object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment