src/Phlexible/Bundle/MessageBundle/Controller/SubscriptionsController.php
public function createAction(Request $request)
    {
        $filterId = $request->get('filter');
        $handler = $request->get('handler');

        $subscriptionManager = $this->get('phlexible_message.subscription_manager');
        $filterManager = $this->get('phlexible_message.filter_manager');

        $filter = $filterManager->find($filterId);

        $subscription = $subscriptionManager->create()
            ->setUserId($this->getUser()->getId())
            ->setFilter($filter)
            ->setHandler($handler);

        $subscriptionManager->updateSubscription($subscription);

        return new ResultResponse(true, 'Subscription created.');
    }
public function createAction(Request $request)
    {
        $filterId = $request->get('filter');
        $handler = $request->get('handler');

        $subscriptionManager = $this->get('phlexible_message.subscription_manager');
        $filterManager = $this->get('phlexible_message.filter_manager');

        $filter = $filterManager->find($filterId);

        $subscription = $subscriptionManager->create()
            ->setUserId($this->getUser()->getId())
            ->setFilter($filter)
            ->setHandler($handler);

        $subscriptionManager->updateSubscription($subscription);

        return new ResultResponse(true, 'Subscription created.');
    }
public function createAction ( Request $ request ) { $ filterId = $ request -> get ( 'filter' ) ; $ handler = $ request -> get ( 'handler' ) ; $ subscriptionManager = $ this -> get ( 'phlexible_message.subscription_manager' ) ; $ filterManager = $ this -> get ( 'phlexible_message.filter_manager' ) ; $ filter = $ filterManager -> find ( $ filterId ) ; $ subscription = $ subscriptionManager -> create ( ) -> setUserId ( $ this -> getUser ( ) -> getId ( ) ) -> setFilter ( $ filter ) -> setHandler ( $ handler ) ; $ subscriptionManager -> updateSubscription ( $ subscription ) ; return new ResultResponse ( true , 'Subscription created.' ) ; }
Create subscription.

@param Request $request

@return ResultResponse
@Route("/create", name="messages_subscription_create")
Create subscription .