troydavisson / PHRETS

PHP client library for interacting with a RETS server to pull real estate listings, photos and other data made available from an MLS system
http://troda.com
MIT License
452 stars 237 forks source link

Wiki Documentation is Out of Date for PHRETS 2.0 #96

Open ooglek opened 8 years ago

ooglek commented 8 years ago

The documentation for PHRETS 2.0 in the Wiki is not accurate. There are methods documented that no longer exist (such as GetMetadataTable, now GetTableMetadata) and methods that don't exist at all (such as GetAllLookupValues).

The documentation and examples are pretty important -- it'd be great to see those updated.

troydavisson commented 8 years ago

Between the primary readme in the repo and phrets.readthedocs.org, the rest of the nuts and bolts should be provided by a decently modern IDE or editor. I don't disagree that the wiki needs updated (or at least clarified that it only pertains to version 1.x), but it's not been a terribly high priority.

ooglek commented 8 years ago

Less handy when you are developing on a remote server and not locally, or using VIM as your editor without a ton of addons.

I can read the code, but it would be nicer to have examples and function references that load nicely into Dash (or similar).

http://phrets.readthedocs.org/en/latest/functions/ <-- Empty http://phrets.readthedocs.org/en/latest/examples/ <-- very light

For example, how do I iterate through all the variables returned by $rets->GetSystemMetadata()? Merge $system->getXmlElements and $system->getXmlAttributes and loop through them, calling the "get{$varname}" method on $system. Stuff like that would have been nice to have known rather than figure out.

Other things, like Laravel's Illuminate Collection inclusions with inheritance are things I'm confident you have great reason to use, but unless the nuts and bolts are explained, and then know to go read the Laravel documentation on the Collection methods, the usefulness is lost.

ooglek commented 8 years ago

Oops, meant to comment, not close. Reopening.

brettalton commented 8 years ago

I would like to comment that at least noting that the information in the wiki is PHRETS 1.x is high priority, as it's wasted a number of human hours from myself and others to come to the conclusion that I was using PHRETS 2.2 and reading the wiki, which was 1.x.

It looks like we can travel to the wiki and just hit "Edit" and make our changes there, no?

andrew-ok7 commented 8 years ago

Dang, wasted all day trying to get these things to work, so how what is the new "GetSystemMetadata()"?

ooglek commented 8 years ago

GetSystemMetadata() returns an object of "PHRETS\Models\Metadata\System" which extends Base.

In order to access the data contained in this object, this is what I do:

$system = $rets->GetSystemMetadata();
foreach(array_merge($system->getXmlElements(), $system->getXmlAttributes()) as $attr) {
    $f = 'get' . $attr; // prepend "get" since we cannot access anything directly or through a single method
    print "  " . $attr . ": " . $system->$f() . "\n"; // print out the result of e.g. $system->getSystemID 
}

The idea here is that the method getXmlElements returns the key names returned, Then getXmlAttributes returns another set, attributes about the system metadata.

In the end there are really just 5 methods that the object GetSystemMetadata returns:

  1. getSystemID
  2. getSystemDescription
  3. getTimeZoneOffset
  4. getComments
  5. getVersion

Hope that helps.

andrew-ok7 commented 8 years ago

Thanks I will give that a try, I started pulling apart RETSMD and realized that is made up of 1.0 so I went back and started looking that version over, which lead me to wonder - If 1.0 works, and is still being used for retsmd.com, then why is phrets 2.0 better? Thanks again, I will stick it out with 2.0 for a bit longer.

tjacobmas commented 8 years ago

Hi Guys, I am a days old using phrets (using version 2.0), can you help me get some reference or sample codes using the CRUD functionality. The docs that i read was to confusing and some are not working in version 2.0. I just want to know how to add, edit, delete, update a listing from the RETS server via the PHRETS Framework. Is this possible or am I in the right track?

intrepidws commented 7 years ago

@ooglek did you ever figure out a way to use something like GetAllLookupValues() in 2.0?

steveheinsch commented 7 years ago

@intrepidws Here's a gist I whipped up as an example of retrieving all lookup values for a Resource/Class https://gist.github.com/steveheinsch/287edd5ce26e608b06b20af384f4cc1e

ooglek commented 7 years ago

@intrepidws I did, I switched to LibRETS. There's a significant memory issue in PHRETS where one variable self-references the returned search object. Even after fixing that, PHRETS still uses so much memory with all of the Laravel framework "helpers" that I threw it out entirely. 😞

steveheinsch commented 7 years ago

@ooglek afaik that memory leak was fixed a few weeks ago when 2.3 was released as stable. Most of my largest requests pulling down all records now barely consume more than 5M max.

intrepidws commented 7 years ago

@steveheinsch Thanks for that gist, very helpful.

@ooglek Thanks for letting me know.

approachings commented 6 years ago

incredibly bad documentation for 2.0

intrepidws commented 6 years ago

Perhaps you could contribute then.