public function createBasketAction(Request $request)
    {
        $name = $request->get('name');

        if (trim(strip_tags($name)) === '') {
            return $this->getBadRequestAction($request, 'Missing basket name parameter');
        }

        $Basket = new Basket();
        $Basket->setUser($this->getAuthenticatedUser());
        $Basket->setName($name);

        /** @var EntityManager $em */
        $em = $this->app['orm.em'];
        $em->persist($Basket);
        $em->flush();

        return Result::create($request, ["basket" => $this->listBasket($Basket)])->createResponse();
    }
public function createBasketAction(Request $request)
    {
        $name = $request->get('name');

        if (trim(strip_tags($name)) === '') {
            return $this->getBadRequestAction($request, 'Missing basket name parameter');
        }

        $Basket = new Basket();
        $Basket->setUser($this->getAuthenticatedUser());
        $Basket->setName($name);

        /** @var EntityManager $em */
        $em = $this->app['orm.em'];
        $em->persist($Basket);
        $em->flush();

        return Result::create($request, ["basket" => $this->listBasket($Basket)])->createResponse();
    }
public function createBasketAction ( Request $ request ) { $ name = $ request -> get ( 'name' ) ; if ( trim ( strip_tags ( $ name ) ) === '' ) { return $ this -> getBadRequestAction ( $ request , 'Missing basket name parameter' ) ; } $ Basket = new Basket ( ) ; $ Basket -> setUser ( $ this -> getAuthenticatedUser ( ) ) ; $ Basket -> setName ( $ name ) ; /** @var EntityManager $em */ $ em = $ this -> app [ 'orm.em' ] ; $ em -> persist ( $ Basket ) ; $ em -> flush ( ) ; return Result :: create ( $ request , [ "basket" => $ this -> listBasket ( $ Basket ) ] ) -> createResponse ( ) ; }
Create a new basket

@param  Request $request

@return Response
Create a new basket