/** * Load Ticket by given ticket id * * @ApiDoc( * description="Returns a ticket", * uri="/tickets/{id}.{_format}", * method="GET", * resource=true, * requirements={ * { * "name"="id", * "dataType"="integer", * "requirement"="\d+", * "description"="Ticket Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to see ticket", * 404="Returned when the ticket is not found" * } * ) * * @param int $id * @return \Diamante\DeskBundle\Model\Ticket\Ticket */ public function loadTicket($id) { return parent::loadTicket($id); }
public function testLoadTicket() { $this->ticketRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_TICKET_ID))->will($this->returnValue($this->ticket)); $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('VIEW'), $this->equalTo($this->ticket))->will($this->returnValue(true)); $this->ticketService->loadTicket(self::DUMMY_TICKET_ID); }
/** * Retrieves Person (Provider or Assignee) Data based on typed ID provided * * @ApiDoc( * description="Returns person data", * uri="/ticket/{id}/assignee.{_format}", * method="GET", * resource=true, * requirements={ * { * "name"="id", * "dataType"="integer", * "requirement"="\d+", * "description"="Ticket Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to view tickets" * } * ) * * @param $id * @return array */ public function getAssigneeForTicket($id) { $ticket = parent::loadTicket($id); $assignee = $ticket->getAssignee(); $details = []; if (!empty($assignee)) { $assigneeAdapter = new User($assignee->getId(), User::TYPE_ORO); $details = $this->userService->fetchUserDetails($assigneeAdapter); } return $details; }