Created
November 20, 2012 15:39
-
-
Save pedroresende/4118681 to your computer and use it in GitHub Desktop.
Stack Trace Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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