On premise issue building models
CitizenDev opened this issue · 2 comments
Hi.
I finally got to testing the SDK on on-premise test environment.
I was able to get connection working after modifying SDK.php file line 80 from
'base_uri' => "https://api.businesscentral.dynamics.com/v2.0/$this->tenant/$this->environment/ODataV4/",
to
'base_uri' => "$this->tenant/ODataV4/",
and passing on-prem service url while starting instance and removing cloud prefix alltogether.
But I'm having issues building models and populating entities.md and was hoping you could help me out a bit.
First I tried post-autoload-dump script. I failed passing credentials from composer.json. Composer simply did not validate json. Then I tried defining default variable values at Constructor.php buildModels function. Then the script ran but ended up with error:
Script BusinessCentral\Constructor::buildModels handling the post-autoload-dump event terminated with an exception [ErrorException] Object of class Composer\Script\Event could not be converted to string
Finnaly tried building models directly from php script by calling
BusinessCentral\Constructor::buildModels( 'server:port/instance', 'username', 'password' );
And got buntch of undefined index errors and failing:
Undefined index: NAV in C:\wamp64\www\ekodumaja\vendor\coolrunner\business-central-sdk\src\Schema.php on line 59 Undefined index: @attributes in C:\wamp64\www\ekodumaja\vendor\coolrunner\business-central-sdk\src\Schema.php on line 40 Undefined index: Namespace in C:\wamp64\www\ekodumaja\vendor\coolrunner\business-central-sdk\src\Schema.php on line 40 Undefined index: NAV.ComplexTypes in C:\wamp64\www\ekodumaja\vendor\coolrunner\business-central-sdk\src\Schema.php on line 55 Invalid argument supplied for foreach() in C:\wamp64\www\ekodumaja\vendor\coolrunner\business-central-sdk\src\Schema.php on line 55
Am I missing something obvious here?
Maybe you can provide me sample of your working composer.json in case i'm not including something important there.
If I get some time I will make a fork and make pull request regarding on-premise tenant URL fix.
Hey @CitizenDev
Did you figure it out?
Nope, I ended up developing my own class for BC oData V4 CRUD operations.