Controller/JobController.php
public function addAction(Request $request)
    {
        $job = $this->deserializeJob($request);

        if ($response = $this->validateJob($job)) {
            return $this->serialize($response, 400);
        }

        try {
            return $this->serialize($this->getManager()->add($job));
        } catch (ValidationFailedException $e) {
            $response = new BadRequestResponse('Invalid request', 'The request contains invalid job parameters');
            $response->setErrors($e->getConstraintViolationList());

            return $this->serialize($response, 400);
        }
    }
public function addAction(Request $request)
    {
        $job = $this->deserializeJob($request);

        if ($response = $this->validateJob($job)) {
            return $this->serialize($response, 400);
        }

        try {
            return $this->serialize($this->getManager()->add($job));
        } catch (ValidationFailedException $e) {
            $response = new BadRequestResponse('Invalid request', 'The request contains invalid job parameters');
            $response->setErrors($e->getConstraintViolationList());

            return $this->serialize($response, 400);
        }
    }
public function addAction ( Request $ request ) { $ job = $ this -> deserializeJob ( $ request ) ; if ( $ response = $ this -> validateJob ( $ job ) ) { return $ this -> serialize ( $ response , 400 ) ; } try { return $ this -> serialize ( $ this -> getManager ( ) -> add ( $ job ) ) ; } catch ( ValidationFailedException $ e ) { $ response = new BadRequestResponse ( 'Invalid request' , 'The request contains invalid job parameters' ) ; $ response -> setErrors ( $ e -> getConstraintViolationList ( ) ) ; return $ this -> serialize ( $ response , 400 ) ; } }
Adds a new job.
@Operation(
tags={"AbcJobBundle"},
summary="Adds a job",
@SWG\Response(
response="200",
description="Returned when successful"
),
@SWG\Response(
response="400",
description="Form validation error"
),
@SWG\Parameter(
name="ticket",
in="query",
type="string",
required=true,
description="The job ticket"
)
)

@param Request $request
@return Response
Adds a new job . @Operation ( tags = { AbcJobBundle } summary = Adds a job @SWG \ Response ( response = 200 description = Returned when successful ) @SWG \ Response ( response = 400 description = Form validation error ) @SWG \ Parameter ( name = ticket in = query type = string required = true description = The job ticket ) )