public function ParseJSONToChannel($json)
{
$logger = \Swiftriver\Core\Setup::GetLogger();
$logger->log("Core::Workflows::ChannelServices::ChannelServicesBase::ParseJSONToChannel [Method invoked]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::ChannelServices::ChannelServicesBase::ParseJSONToChannel [START: Creating new Channel]", \PEAR_LOG_DEBUG);
try {
//Try and get a Channel from the factory
$channel = \Swiftriver\Core\ObjectModel\ObjectFactories\ChannelFactory::CreateChannelFromJSON($json);
} catch (\Exception $e) {
//If exception, get the mesasge
$message = $e->getMessage();
//and log it
$logger->log("Core::Workflows::ChannelServices::ChannelServicesBase::ParseJSONToChannel [{$message}]", \PEAR_LOG_ERR);
$logger->log("Core::Workflows::ChannelServices::ChannelServicesBase::ParseJSONToChannel [Method finished]", \PEAR_LOG_INFO);
throw new \InvalidArgumentException("The JSON passed to this method did not contain data required to construct a Channel object: {$message}");
}
$logger->log("Core::Workflows::ChannelServices::ChannelServicesBase::ParseJSONToChannel [END: Creating new Channel]", \PEAR_LOG_DEBUG);
$logger->log("Core::Workflows::ChannelServices::ChannelServicesBase::ParseJSONToChannel [Method finished]", \PEAR_LOG_DEBUG);
return $channel;
}