public function listAction() { $result = $this->client->findAll(); foreach ($result->tickets as $ticket) { $this->message()->show(sprintf('Id : [info]%s[/info] Subject : [info]%s[/info] Description : [info]%s[/info] ------------------------------------------------------------', $ticket->id, $ticket->subject, $ticket->description)); } }
/** * Returns a collection of items for a page. * * @param int $offset Page offset * @param int $itemCountPerPage Number of items per page * @return array */ public function getItems($offset, $itemCountPerPage) { $params = ['page' => $offset, 'per_page' => $itemCountPerPage]; $result = $this->client->findAll($params); $this->count = $result->count; if (is_array($result->tickets)) { $hydrator = new ObjectProperty(); $tickets = array_map(function ($ticket) use($hydrator) { $array = $hydrator->extract($ticket); $ticket = new TicketEntity(); $ticket->exchangeArray($array); return $ticket; }, $result->tickets); } else { $tickets = []; } return $tickets; }