Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Conditions do not appear to be working #8

Closed
MikeKMiller opened this issue Jun 8, 2016 · 3 comments
Closed

Conditions do not appear to be working #8

MikeKMiller opened this issue Jun 8, 2016 · 3 comments
Labels

Comments

@MikeKMiller
Copy link

When attempting to find an entity (Company, Contact, Configuration,etc...) conditions appear to be being ignored.

$client = new Spinen\ConnectWise\Client\Client($config); $contacts = $client->contactApiFindContacts(['where' => 'CompanyId = 250']); $contactsreturn = $client->execute();

This returns ALL contacts and ignores the condition.

@jimmypuckett
Copy link
Member

So, we don't use it like that. I will need to do some digging into the code & get you an answer. We use it chained (fluent)...

Psy Shell v0.7.2 (PHP 7.0.7 — cli) by Justin Hileman
>>> $config = ['connectwise' => config()['services']['connectwise']]
=> [
     "connectwise" => [
       "host" => "REMOVED",
       "company" => "REMOVED",
       "username" => "REMOVED",
       "password" => "REMOVED!",
     ],
   ]
>>> $client = new Spinen\ConnectWise\Client\Client($config);
=> Spinen\ConnectWise\Client\Client {#6768}
>>> $client->contactApiFindContacts()->get()->count();
=> 1998
>>> $client->contactApiFindContacts()->whereCompanyIdEquals(250)->get()->count();
=> 37
>>> $client->contactApiFindContacts()->whereCompanyIdEquals(250)->orWhereCompanyIdEquals(19303)->get()->count();
=> 84
>>> $client->contactApiFindContacts()->whereCompanyIdGreaterThan(250)->get()->count();
=> 1945

As you can see, we are pulling the configs from the Laravel config helper, and then making a new client.

Also, this repo is really about the generator, which you probably don't need. The SPINEN's ConnectWise PHP Client is really the one that you probably want to be using.

I will dig into the code in the ned few days look into passing the filter in the constructor as you are doing it.

Sorry that there is not more documentation on the client.

Good luck & let us know if we can help!

@MikeKMiller
Copy link
Author

Ok, then I was trying to use it incorrectly. Could we please get some examples of usage for scenerios such as (searching for something, opening specific items like a specific contact, updating/adding an item)?

Any help you can provide is greatly appreciated.

Thanks,
Mike Miller

@jimmypuckett
Copy link
Member

It is kind of hard to use it correctly when there is no docs!!!

I will see what we can get done to better document it on the client repo.

I made an issue for it here...

spinen/connectwise-php-client#1

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants