Closed minhtranite closed 6 years ago
Can you try running as RETS 1.7.2 client (you're using 1.5)?
It looks like the server isn't capable of returning paginated results (at least using version 1.5). It retrieves the first "page" fine (22:54:57 DEBUG [app] 2000 results given), but when it tries to retrieve the next "page" of results (22:54:57 DEBUG [app] Continuing pagination...), it receives 0 (22:54:57 DEBUG [app] 0 results given). So then you try to run ->toArray() on an empty collection.
You're not showing any code so hard to see what's going on, but I'd check to see if you actually received results before running toArray() or any further processing.
@steveheinsch, I have tried but still got the error.
09:44:31 DEBUG [app] Sending HTTP Request for http://connectmls-rets.mredllc.com:80/rets/server/search (Search)
[
"auth" => [
"*****",
"*****",
"digest"
],
"headers" => [
"User-Agent" => "PHRETS/2.0",
"RETS-Version" => "RETS/1.7.2",
"Accept-Encoding" => "gzip",
"Accept" => "*/*"
],
"curl" => [
10031 => "/tmp/phretsC6vVSN"
],
"query" => [
"SearchType" => "Property",
"Class" => "ResidentialProperty",
"Query" => "(STATE=IL),(ST=ACTV,BOMK,NEW,PCHG,RACT,AUCT,CLSD,PEND,CTG),(LD=2017-01-01+)",
"QueryType" => "DMQL2",
"Count" => 1,
"Format" => "COMPACT-DECODED",
"Limit" => 99999999,
"StandardNames" => 0,
"Offset" => 28001
]
]
[]
09:44:32 DEBUG [app] Response: HTTP 200
[]
[]
09:44:32 DEBUG [app] Assuming TAB delimiter since none specified in response
[]
[]
09:44:32 DEBUG [app] 1 column headers/fields given
[]
[]
09:44:32 DEBUG [app] 0 results given
In my command I just call $results = $this->rets->getResidentialProperties();
. and here is my helper class:
<?php
namespace RetsBundle\Helper;
use Monolog\Logger;
use PHRETS\Configuration;
use PHRETS\Session;
use RetsBundle\Entity\ResidentialProperty;
class RetsHelper
{
private $url;
private $username;
private $password;
private $logger;
private $rets;
public function __construct(string $url, string $username, string $password, Logger $logger)
{
$this->url = $url;
$this->username = $username;
$this->password = $password;
$this->logger = $logger;
$config = new Configuration();
$config->setRetsVersion('1.7.2');
$config->setLoginUrl($this->url);
$config->setUsername($this->username);
$config->setPassword($this->password);
$this->rets = new Session($config);
$this->rets->setLogger($this->logger);
$this->rets->Login();
}
public function getResidentialProperties(int $offset = 0)
{
$status = implode(',', ResidentialProperty::ALLOW_STATUS);
$options = [];
if ($offset > 0) {
$options['Offset'] = $offset;
}
return $this->rets->Search(
'Property',
'ResidentialProperty',
'(STATE=IL),(ST='.$status.'),(LD=2017-01-01+)',
$options,
true
);
}
public function getPropertyStates()
{
$results = [];
$lookUpValues = $this->rets->GetLookupValues('Property', 'STATE');
/** @var \PHRETS\Models\Metadata\LookupType $item */
foreach ($lookUpValues as $item) {
$results[$item->getValue()] = $item->getLongValue();
}
return $results;
}
public function getPropertyStatus()
{
$results = [];
$lookUpValues = $this->rets->GetLookupValues('Property', 'ST');
/** @var \PHRETS\Models\Metadata\LookupType $item */
foreach ($lookUpValues as $item) {
$results[$item->getValue()] = $item->getLongValue();
}
return $results;
}
public function getPropertyPhotos($ids)
{
return $this->rets->GetObject('Property', 'HrPhoto', $ids);
}
}
I have tried dump the response when error like that:
if($response->getHeader('Content-Type') !== 'text/xml;charset=utf-8'){
dump($response->getBody()->getContents());
}
and got this message
<RETS ReplyCode="20036" ReplyText="Duplicate login detected - this session is invalid" >\n
</RETS>\r\n
Seems it isn't problem of PHRETS so I will close this issue.
I created a symfony command to get RETS data but got exception: Here is log: