For using Facade class to create Object, the value assigned to each field can only be either a)a string or integer or b) a complex object type matching the type of the field, it cannot be boolean value, however.
An Item created using like this will not work:
$item = Item::create([
"Name" => "1ParentRef_Inventory",
"Description"=> "Sales for it would be good",
"Active"=> true,
"SubItem"=> true,
"ParentRef"=> [
"value"=> "1",
"name"=> "Services"
],
"Taxable"=> true,
"UnitPrice"=> 10,
"Type"=> "Inventory",
"IncomeAccountRef"=> [
"value"=> "79",
"name"=> "Sales of Product Income"
],
"PurchaseDesc"=> "Purchase information",
"PurchaseCost"=> 10,
"ExpenseAccountRef"=> [
"value"=> "80",
"name"=>"Cost of Goods Sold"
],
"AssetAccountRef"=> [
"value"=> "81",
"name"=> "Inventory Asset"
],
"TrackQtyOnHand"=> true,
"QtyOnHand"=> 10,
"InvStartDate"=> "2017-07-27",
"domain"=> "QBO"
]);
The request will be:
<ns0:Item xmlns:ns0="http://schema.intuit.com/finance/v3" domain="QBO">
ns0:Name1223ParentRef_Inventory</ns0:Name>
ns0:DescriptionSales for it would be good</ns0:Description>
ns0:Active/
ns0:SubItem/
<ns0:ParentRef name="Services">1</ns0:ParentRef>
ns0:Taxable/
ns0:UnitPrice10</ns0:UnitPrice>
ns0:TypeInventory</ns0:Type>
<ns0:IncomeAccountRef name="Sales of Product Income">79</ns0:IncomeAccountRef>
ns0:PurchaseDescPurchase information</ns0:PurchaseDesc>
ns0:PurchaseCost10</ns0:PurchaseCost>
<ns0:ExpenseAccountRef name="Cost of Goods Sold">80</ns0:ExpenseAccountRef>
<ns0:AssetAccountRef name="Inventory Asset">81</ns0:AssetAccountRef>
ns0:TrackQtyOnHand/
ns0:QtyOnHand10</ns0:QtyOnHand>
ns0:InvStartDate2017-07-27</ns0:InvStartDate>
</ns0:Item>
It needs to be like this:
$item = Item::create([
"Name" => "1ParentRef_Inventory",
"Description"=> "Sales for it would be good",
"Active"=> "true",
"SubItem"=> "true",
"ParentRef"=> [
"value"=> "1",
"name"=> "Services"
],
"Taxable"=> "true",
"UnitPrice"=> "10",
"Type"=> "Inventory",
"IncomeAccountRef"=> [
"value"=> "79",
"name"=> "Sales of Product Income"
],
"PurchaseDesc"=> "Purchase information",
"PurchaseCost"=> "10",
"ExpenseAccountRef"=> [
"value"=> "80",
"name"=>"Cost of Goods Sold"
],
"AssetAccountRef"=> [
"value"=> "81",
"name"=> "Inventory Asset"
],
"TrackQtyOnHand"=> "true",
"QtyOnHand"=> "10",
"InvStartDate"=> "2017-07-27",
"domain"=> "QBO"
]);