2pisoftware / cmfive

DEPRECATED! Please see https://github.com/2pisoftware/cmfive-core for new version
http://cmfive.com
4 stars 4 forks source link

Added function to return new or failed messages from the Channel module #220

Closed adam-buckley closed 8 years ago

adam-buckley commented 8 years ago

Please test reliability over multiple use cases:

To ensure correct data will be returned

iceaxeliehne commented 8 years ago

Function returns only both failed and new. You could either add parameter to determine return inclusion for different types, or change function name to "getNewAndFailedMessages".

From the returned array it is tricky to tell if you have a new or failed message. Calling getStatus on a "new" ChannelMessage returns 'NULL'.
$message = $this->getNewOrFailedMessages($channel_id, $processor_id)[0]; $status = $message->getStatus($channel_id) $status = is_null($status) ? 'new' : ($status->is_successful == 0 ? 'failed' : 'successful'); This function should probably make it easier to tell which is 'new' and which is 'failed'?