Exemplo n.º 1
0
 public function findLocations(\App_ListFilter $filterList, $numRows = 1000)
 {
     $methodName = 'locationList';
     /**
      * @var $proto \Application\Proto\Inventory\LocationListQuery
      */
     $proto = $this->_createProto($methodName);
     if (!$filterList->getCursor()) {
         $this->_findAllEricsson(array('filterList' => $filterList));
         $filterList->reset();
         if (!$filterList->getCursor()) {
             throw new InvalidArgumentException('Listing sims locations: Invalid query.');
         }
     }
     $proto->setHandler($filterList->getCursor());
     $proto->setMaxNumRows($numRows);
     /**
      * @var $response \Application\Proto\Inventory\LocationListQuery\Response
      */
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     $this->_checkGetResponse($response, true);
     $result = new Model\ListResultModel();
     $result->setCount(0);
     $responseLocationList = $response->getResponse();
     if ($responseLocationList) {
         $items = $responseLocationList->getRows();
         $its = array();
         foreach ($items as $id => $data) {
             $data = $data->serialize(new Codec\PhpArray());
             $data = $this->_mapEricssonModelToModel($data);
             $its[$id] = new SimModel($data);
         }
         $result->setItems($its);
         if ($responseLocationList->getNumRows() !== null) {
             $result->setCount($responseLocationList->getNumRows());
         }
     }
     return $result;
 }