public static function createSubscriptions($dbSubscriptions)
    {
        if (!is_array($dbSubscriptions)) {
            $dbSubscriptions = [$dbSubscriptions];
        }
        $result = [];
        foreach ($dbSubscriptions as $dbSubscription) {
            $attributes = $dbSubscription->getAttributes();
            unset($attributes['id']);
            unset($attributes['queue_id']);
            unset($attributes['is_deleted']);
            $subscription = new components\Subscription();
            $subscription->setAttributes($attributes);
            foreach ($dbSubscription->categories as $category) {
                if (!$category->is_exception) {
                    $subscription->categories[] = $category->category;
                } else {
                    $subscription->exceptions[] = $category->category;
                }
            }
            $result[] = $subscription;
        }

        return $result;
    }
public static function createSubscriptions($dbSubscriptions)
    {
        if (!is_array($dbSubscriptions)) {
            $dbSubscriptions = [$dbSubscriptions];
        }
        $result = [];
        foreach ($dbSubscriptions as $dbSubscription) {
            $attributes = $dbSubscription->getAttributes();
            unset($attributes['id']);
            unset($attributes['queue_id']);
            unset($attributes['is_deleted']);
            $subscription = new components\Subscription();
            $subscription->setAttributes($attributes);
            foreach ($dbSubscription->categories as $category) {
                if (!$category->is_exception) {
                    $subscription->categories[] = $category->category;
                } else {
                    $subscription->exceptions[] = $category->category;
                }
            }
            $result[] = $subscription;
        }

        return $result;
    }
public static function createSubscriptions ( $ dbSubscriptions ) { if ( ! is_array ( $ dbSubscriptions ) ) { $ dbSubscriptions = [ $ dbSubscriptions ] ; } $ result = [ ] ; foreach ( $ dbSubscriptions as $ dbSubscription ) { $ attributes = $ dbSubscription -> getAttributes ( ) ; unset ( $ attributes [ 'id' ] ) ; unset ( $ attributes [ 'queue_id' ] ) ; unset ( $ attributes [ 'is_deleted' ] ) ; $ subscription = new components \ Subscription ( ) ; $ subscription -> setAttributes ( $ attributes ) ; foreach ( $ dbSubscription -> categories as $ category ) { if ( ! $ category -> is_exception ) { $ subscription -> categories [ ] = $ category -> category ; } else { $ subscription -> exceptions [ ] = $ category -> category ; } } $ result [ ] = $ subscription ; } return $ result ; }
Creates an array of Subscription objects from DbSubscription objects.
@param  DbSubscription|array $dbSubscriptions one or more DbSubscription objects
@return array                of Subscription objects
Creates an array of Subscription objects from DbSubscription objects .