public static function createMessages($dbMessages)
    {
        if (!is_array($dbMessages)) {
            $dbMessages = [$dbMessages];
        }
        $result = [];
        foreach ($dbMessages as $dbMessage) {
            $attributes = $dbMessage->getAttributes();
            $attributes['subscriber_id'] = $dbMessage->subscription_id === null ? null : $dbMessage->subscription->subscriber_id;
            unset($attributes['queue_id']);
            unset($attributes['subscription_id']);
            unset($attributes['mimetype']);
            $message = new components\Message();
            $message->setAttributes($attributes);
            $result[] = $message;
        }

        return $result;
    }
public static function createMessages($dbMessages)
    {
        if (!is_array($dbMessages)) {
            $dbMessages = [$dbMessages];
        }
        $result = [];
        foreach ($dbMessages as $dbMessage) {
            $attributes = $dbMessage->getAttributes();
            $attributes['subscriber_id'] = $dbMessage->subscription_id === null ? null : $dbMessage->subscription->subscriber_id;
            unset($attributes['queue_id']);
            unset($attributes['subscription_id']);
            unset($attributes['mimetype']);
            $message = new components\Message();
            $message->setAttributes($attributes);
            $result[] = $message;
        }

        return $result;
    }
public static function createMessages ( $ dbMessages ) { if ( ! is_array ( $ dbMessages ) ) { $ dbMessages = [ $ dbMessages ] ; } $ result = [ ] ; foreach ( $ dbMessages as $ dbMessage ) { $ attributes = $ dbMessage -> getAttributes ( ) ; $ attributes [ 'subscriber_id' ] = $ dbMessage -> subscription_id === null ? null : $ dbMessage -> subscription -> subscriber_id ; unset ( $ attributes [ 'queue_id' ] ) ; unset ( $ attributes [ 'subscription_id' ] ) ; unset ( $ attributes [ 'mimetype' ] ) ; $ message = new components \ Message ( ) ; $ message -> setAttributes ( $ attributes ) ; $ result [ ] = $ message ; } return $ result ; }
Creates an array of Message objects from DbMessage objects.
@param  DbMessage|array $dbMessages one or more DbMessage objects
@return array           of Message objects
Creates an array of Message objects from DbMessage objects .