/** * @return array */ public function findConnections(ConnectionQuery $query) { // send request $result = $this->sendAndParseQuery($query); // load pages for ($i = 0; $i < abs($query->page); $i++) { // load next page $pageQuery = new ConnectionPageQuery($query, (string) $result->ConRes->ConResCtxt); $result = $this->sendAndParseQuery($pageQuery); } $connections = []; if ($result->ConRes->ConnectionList->Connection) { foreach ($result->ConRes->ConnectionList->Connection as $connection) { $connections[] = Entity\Schedule\Connection::createFromXml($connection, null); } } return $connections; }
/** * @return array */ public function findConnections(ConnectionQuery $query) { // send request $response = $this->sendQuery($query); // parse result $result = simplexml_load_string($response->getContent()); // load pages for ($i = 0; $i < abs($query->page); $i++) { // load next page $pageQuery = new ConnectionPageQuery($query, (string) $result->ConRes->ConResCtxt); $response = $this->sendQuery($pageQuery); $result = simplexml_load_string($response->getContent()); } $connections = array(); if ($result->ConRes->ConnectionList->Connection) { foreach ($result->ConRes->ConnectionList->Connection as $connection) { $connections[] = Entity\Schedule\Connection::createFromXml($connection, null); } } return $connections; }
public function testCreateFromXml() { $xml = simplexml_load_file(__DIR__ . '/../../../../fixtures/archive/connection-2012-01-16.xml'); $this->assertEquals($this->getConnection(), Connection::createFromXml($xml->ConRes->ConnectionList->Connection)); }