I prepared LocationSearch object and sent to NetSuite server
But in result, subsidiaryList of Location Object always is null, it should be same with parent property.
[record] => Array
(
[0] => Location Object
(
[name] => zzzzzz
[parent] => RecordRef Object
(
[internalId] => 7
[externalId] =>
[type] =>
[name] => xxxxxxxx
)
[includeChildren] =>
[subsidiaryList] =>
[isInactive] =>
[tranPrefix] =>
[attention] =>
[addressee] => zzzz
[addrPhone] =>
[addr1] =>
[addr2] =>
[addr3] =>
[city] =>
[state] =>
[zip] =>
[country] => _zz
[addrText] => zzzzz
[override] =>
[logo] =>
[makeInventoryAvailable] => 1
[makeInventoryAvailableStore] => 1
[classTranslationList] =>
[customFieldList] =>
[internalId] => 11
[externalId] =>
[nullFieldList] =>
)
................
$paramtypesmap of class Location
"name" => "string",
"parent" => "RecordRef",
"includeChildren" => "boolean",
"subsidiaryList" => "RecordRefList",
"isInactive" => "boolean",
"tranPrefix" => "string",
"attention" => "string",
"addressee" => "string",
"addrPhone" => "string",
"addr1" => "string",
"addr2" => "string",
"addr3" => "string",
"city" => "string",
"state" => "string",
"zip" => "string",
"country" => "Country",
"addrText" => "string",
"override" => "boolean",
"logo" => "RecordRef",
"makeInventoryAvailable" => "boolean",
"makeInventoryAvailableStore" => "boolean",
"classTranslationList" => "ClassTranslationList",
"customFieldList" => "CustomFieldList",
"internalId" => "string",
"externalId" => "string",
How can i get subsidiaryList of locations from NetSuite ?
Thank you very much
Best regards
Do you have "body fields only" set as a preference?? If so, turn it off.
Related
I'm retrieving some JSON that I am converting to an associative array. The issue that I am having is I am trying to get the email value from the user's who id matches the value that I have already set as a variable.
Here is what the array looks like
Array
(
[object] => list
[data] => Array
(
[0] => Array
(
[object] => pro
[id] => pro_77c9c6a85d814e059a6a2690989bae29
[first_name] => Jane
[last_name] => Doe
[full_name] => Jane Doe
[initials] => JD
[email] => admin#testorg.com
[mobile_number] => 9998761234
[messaging_uuid] => 4547c231c3e7d0ff1796f47b88f166d5
[color_hex] => EF9159
[avatar_url] => /assets/add_image.png
[avatar_thumb_url] =>
[has_avatar] =>
[organization_name] => testorg
[is_admin] => 1
[permissions] => Array
(
[show_company_setup] => 1
[can_see_home_data] => 1
[show_reporting] => 1
)
[is_super_pro] =>
[is_archived] =>
[impersonated] =>
)
[1] => Array
(
[object] => pro
[id] => pro_0fcb8e8610e54c518078db77ced7530e
[first_name] => Robert
[last_name] => Jordan
[full_name] => Robert Jordan
[initials] => RJ
[email] => rj#testorg.com
[mobile_number] => 4547457742
[messaging_uuid] => 0fcb8e8610e54c518078db77ced7530e
[color_hex] => EF9159
[avatar_url] => /assets/add_image.png
[avatar_thumb_url] =>
[has_avatar] =>
[organization_name] => testorg
[is_admin] => 1
[permissions] => Array
(
[show_company_setup] => 1
[can_see_home_data] => 1
[show_reporting] => 1
)
[is_super_pro] =>
[is_archived] =>
[impersonated] =>
)
)
[url] => /pros
)
Im basically trying to match the value that I have set in my pro_id variable
pro_0fcb8e8610e54c518078db77ced7530e
To the 'ID' Key in the array above and get the 'email' value associated to that same array and store for use later in my code.
Here is what I have so far, but no joy
foreach ($proObject as $key => $value) {
if ($key['id'] == $pro_id)
$techmail = $key['email'];
}
From my understanding of your question, and if you want to get only one element, you should be able to use array_search with array_column to get the index of the searched element. Using that you can then access the element and its corresponding email value. If you might expect more than one element I would use array_filter.
One Element:
In short:
$i = array_search($pro_id, array_column($proObject, 'id'));
$element = ($i !== false ? $proObject[$i] : null);
print_r($element["email"]);
Full code:
<?php
$proObject = array(
array(
"object" => "pro",
"id" => "pro_77c9c6a85d814e059a6a2690989bae29",
"first_name" => "Jane",
"last_name" => "Doe",
"full_name" => "Jane Doe",
"initials" => "JD",
"email" => "admin#testorg.com",
"mobile_number" => "9998761234",
"messaging_uuid" => "4547c231c3e7d0ff1796f47b88f166d5",
"color_hex" => "EF9159",
"avatar_url" => "/assets/add_image.png",
"avatar_thumb_url" => "",
"has_avatar" => "",
"organization_name" => "testorg",
"is_admin" => "1",
"permissions" => array(
"show_company_setup" => "1",
"can_see_home_data" => "1",
"show_reporting" => "1",
) ,
"is_super_pro" => "",
"is_archived" => "",
"impersonated" => "",
) ,
array(
"object" => "pro",
"id" => "pro_0fcb8e8610e54c518078db77ced7530e",
"first_name" => "Robert",
"last_name" => "Jordan",
"full_name" => "Robert Jordan",
"initials" => "RJ",
"email" => "rj#testorg.com",
"mobile_number" => "4547457742",
"messaging_uuid" => "0fcb8e8610e54c518078db77ced7530e",
"color_hex" => "EF9159",
"avatar_url" => "/assets/add_image.png",
"avatar_thumb_url" => "",
"has_avatar" => "",
"organization_name" => "testorg",
"is_admin" => "1",
"permissions" => array(
"show_company_setup" => "1",
"can_see_home_data" => "1",
"show_reporting" => "1",
) ,
"is_super_pro" => "",
"is_archived" => "",
"impersonated" => "",
)
);
$pro_id = "pro_0fcb8e8610e54c518078db77ced7530e";
$i = array_search($pro_id, array_column($proObject, 'id'));
$element = ($i !== false ? $proObject[$i] : null);
print_r($element["email"]);
?>
Multiple Elements:
In short:
class idEqualsFilter {
private $id;
public function __construct($id) {
$this->id = $id;
}
function __invoke($i) {
return $this->id === $i["id"];
}
};
$elements = array_filter($proObject, new idEqualsFilter($pro_id));
print_r(array_column($elements, "email"));
Full code:
<?php
$proObject = array(
array(
"object" => "pro",
"id" => "pro_77c9c6a85d814e059a6a2690989bae29",
"first_name" => "Jane",
"last_name" => "Doe",
"full_name" => "Jane Doe",
"initials" => "JD",
"email" => "admin#testorg.com",
"mobile_number" => "9998761234",
"messaging_uuid" => "4547c231c3e7d0ff1796f47b88f166d5",
"color_hex" => "EF9159",
"avatar_url" => "/assets/add_image.png",
"avatar_thumb_url" => "",
"has_avatar" => "",
"organization_name" => "testorg",
"is_admin" => "1",
"permissions" => array
(
"show_company_setup" => "1",
"can_see_home_data" => "1",
"show_reporting" => "1",
),
"is_super_pro" => "",
"is_archived" => "",
"impersonated" => "",
),
array(
"object" => "pro",
"id" => "pro_0fcb8e8610e54c518078db77ced7530e",
"first_name" => "Robert",
"last_name" => "Jordan",
"full_name" => "Robert Jordan",
"initials" => "RJ",
"email" => "rj#testorg.com",
"mobile_number" => "4547457742",
"messaging_uuid" => "0fcb8e8610e54c518078db77ced7530e",
"color_hex" => "EF9159",
"avatar_url" => "/assets/add_image.png",
"avatar_thumb_url" => "",
"has_avatar" => "",
"organization_name" => "testorg",
"is_admin" => "1",
"permissions" => array
(
"show_company_setup" => "1",
"can_see_home_data" => "1",
"show_reporting" => "1",
),
"is_super_pro" => "",
"is_archived" => "",
"impersonated" => "",
)
);
$pro_id = "pro_0fcb8e8610e54c518078db77ced7530e";
class idEqualsFilter {
private $id;
public function __construct($id) {
$this->id = $id;
}
function __invoke($i) {
return $this->id === $i["id"];
}
};
$elements = array_filter($proObject, new idEqualsFilter($pro_id));
print_r(array_column($elements, "email"));
?>
According to QBO docs, in order to update the contents of a bill you should
Use this operation to update any of the writable fields of an existing bill object. The request body must include all writable fields of the existing object as returned in a read response. Writable fields omitted from the request body are set to NULL. The ID of the object to update is specified in the request body.
We query a bill like so
SELECT * FROM Bill where DocNumber='150577' and VendorRef='156'
It returns the following:
(
[0] => QuickBooksOnline\API\Data\IPPBill Object
(
[PayerRef] =>
[SalesTermRef] =>
[DueDate] => 2020-10-22
[RemitToAddr] =>
[ShipAddr] =>
[Balance] => 89.59
[HomeBalance] => 89.59
[BillEx] =>
[VendorRef] => 156
[APAccountRef] => 46
[TotalAmt] => 89.59
[BillEmail] =>
[ReplyEmail] =>
[Memo] =>
[GlobalTaxCalculation] => TaxExcluded
[DocNumber] => 150577
[TxnDate] => 2020-10-22
[DepartmentRef] =>
[CurrencyRef] => CAD
[ExchangeRate] => 1
[PrivateNote] =>
[TxnStatus] =>
[LinkedTxn] =>
[Line] => Array
(
[0] => QuickBooksOnline\API\Data\IPPLine Object
(
[Id] => 1
[LineNum] => 1
[Description] =>
[Amount] => 54.02
[LinkedTxn] =>
[DetailType] => AccountBasedExpenseLineDetail
[PaymentLineDetail] =>
[DiscountLineDetail] =>
[TaxLineDetail] =>
[SalesItemLineDetail] =>
[DescriptionLineDetail] =>
[ItemBasedExpenseLineDetail] =>
[AccountBasedExpenseLineDetail] => QuickBooksOnline\API\Data\IPPAccountBasedExpenseLineDetail Object
(
[CustomerRef] =>
[ClassRef] =>
[AccountRef] => 40
[BillableStatus] => NotBillable
[MarkupInfo] =>
[TaxAmount] =>
[TaxCodeRef] => 22
[TaxInclusiveAmt] =>
[ExpenseDetailLineDetailEx] =>
)
[DepositLineDetail] =>
[PurchaseOrderItemLineDetail] =>
[SalesOrderItemLineDetail] =>
[ItemReceiptLineDetail] =>
[JournalEntryLineDetail] =>
[GroupLineDetail] =>
[SubTotalLineDetail] =>
[TDSLineDetail] =>
[CustomField] =>
[LineEx] =>
)
[1] => QuickBooksOnline\API\Data\IPPLine Object
(
[Id] => 2
[LineNum] => 2
[Description] =>
[Amount] => 23.88
[LinkedTxn] =>
[DetailType] => AccountBasedExpenseLineDetail
[PaymentLineDetail] =>
[DiscountLineDetail] =>
[TaxLineDetail] =>
[SalesItemLineDetail] =>
[DescriptionLineDetail] =>
[ItemBasedExpenseLineDetail] =>
[AccountBasedExpenseLineDetail] => QuickBooksOnline\API\Data\IPPAccountBasedExpenseLineDetail Object
(
[CustomerRef] =>
[ClassRef] =>
[AccountRef] => 37
[BillableStatus] => NotBillable
[MarkupInfo] =>
[TaxAmount] =>
[TaxCodeRef] => 22
[TaxInclusiveAmt] =>
[ExpenseDetailLineDetailEx] =>
)
[DepositLineDetail] =>
[PurchaseOrderItemLineDetail] =>
[SalesOrderItemLineDetail] =>
[ItemReceiptLineDetail] =>
[JournalEntryLineDetail] =>
[GroupLineDetail] =>
[SubTotalLineDetail] =>
[TDSLineDetail] =>
[CustomField] =>
[LineEx] =>
)
[2] => QuickBooksOnline\API\Data\IPPLine Object
(
[Id] => 3
[LineNum] => 3
[Description] =>
[Amount] => 0
[LinkedTxn] =>
[DetailType] => AccountBasedExpenseLineDetail
[PaymentLineDetail] =>
[DiscountLineDetail] =>
[TaxLineDetail] =>
[SalesItemLineDetail] =>
[DescriptionLineDetail] =>
[ItemBasedExpenseLineDetail] =>
[AccountBasedExpenseLineDetail] => QuickBooksOnline\API\Data\IPPAccountBasedExpenseLineDetail Object
(
[CustomerRef] =>
[ClassRef] =>
[AccountRef] => 94
[BillableStatus] => NotBillable
[MarkupInfo] =>
[TaxAmount] =>
[TaxCodeRef] => 22
[TaxInclusiveAmt] =>
[ExpenseDetailLineDetailEx] =>
)
[DepositLineDetail] =>
[PurchaseOrderItemLineDetail] =>
[SalesOrderItemLineDetail] =>
[ItemReceiptLineDetail] =>
[JournalEntryLineDetail] =>
[GroupLineDetail] =>
[SubTotalLineDetail] =>
[TDSLineDetail] =>
[CustomField] =>
[LineEx] =>
)
)
[TxnTaxDetail] => QuickBooksOnline\API\Data\IPPTxnTaxDetail Object
(
[DefaultTaxCodeRef] =>
[TxnTaxCodeRef] =>
[TotalTax] => 11.69
[TaxLine] => QuickBooksOnline\API\Data\IPPLine Object
(
[Id] =>
[LineNum] =>
[Description] =>
[Amount] => 11.69
[LinkedTxn] =>
[DetailType] => TaxLineDetail
[PaymentLineDetail] =>
[DiscountLineDetail] =>
[TaxLineDetail] => QuickBooksOnline\API\Data\IPPTaxLineDetail Object
(
[TaxRateRef] => 37
[PercentBased] => true
[TaxPercent] => 15
[NetAmountTaxable] => 77.90
[TaxInclusiveAmount] =>
[OverrideDeltaAmount] =>
[ServiceDate] =>
[TaxLineDetailEx] =>
)
[SalesItemLineDetail] =>
[DescriptionLineDetail] =>
[ItemBasedExpenseLineDetail] =>
[AccountBasedExpenseLineDetail] =>
[DepositLineDetail] =>
[PurchaseOrderItemLineDetail] =>
[SalesOrderItemLineDetail] =>
[ItemReceiptLineDetail] =>
[JournalEntryLineDetail] =>
[GroupLineDetail] =>
[SubTotalLineDetail] =>
[TDSLineDetail] =>
[CustomField] =>
[LineEx] =>
)
)
[TxnSource] =>
[TaxFormType] =>
[TaxFormNum] =>
[TransactionLocationType] =>
[Id] => 282835
[SyncToken] => 0
[MetaData] => QuickBooksOnline\API\Data\IPPModificationMetaData Object
(
[CreatedByRef] =>
[CreateTime] => 2020-10-22T14:40:58-07:00
[LastModifiedByRef] =>
[LastUpdatedTime] => 2020-10-22T14:40:58-07:00
[LastChangedInQB] =>
[Synchronized] =>
)
[CustomField] =>
[AttachableRef] =>
[domain] =>
[status] =>
[sparse] =>
)
)
We then make some modifications and attempt to repost the updated data using
$out = Bill::update($qb_data_original, $qb_data_updated);
$config = $oAuthKeys->getAsArray();
$resultingBillObj = $dataService->Update($out);
print_r($resultingBillObj);
But the error we get says
PHP Fatal error: Uncaught Exception: Can't convert Passed Parameter to IPPReferenceType. in /var/www/html/vendor/quickbooks/v3-php-sdk/src/Facades/FacadeHelper.php:293
Stack trace:
#0 [internal function]: QuickBooksOnline\API\Facades\FacadeHelper::getIPPReferenceTypeBasedOnArray(NULL, 'PayerRef')
#1 /var/www/html/vendor/quickbooks/v3-php-sdk/src/Facades/FacadeHelper.php(195): ReflectionMethod->invoke(NULL, NULL, 'PayerRef')
#2 /var/www/html/vendor/quickbooks/v3-php-sdk/src/Facades/FacadeHelper.php(117): QuickBooksOnline\API\Facades\FacadeHelper::getComplexListObject('getIPPReference...', 'PayerRef', NULL)
#3 /var/www/html/vendor/quickbooks/v3-php-sdk/src/Facades/Bill.php(8): QuickBooksOnline\API\Facades\FacadeHelper::reflectArrayToObject('Bill', Array, true)
#4 /var/www/html/vendor/quickbooks/v3-php-sdk/src/Facades/Bill.php(17): QuickBooksOnline\API\Facades\Bill::create(Array)
#5 /var/www/html/qb_match.php(214): QuickBooksOnline\API\Facades\Bill::update(Object(QuickBooksOnline\API\Data\IPPBill), Array)
#6 {main}
thrown in /var/www/html/vendor/quickbooks/v3-php-sdk/src/Facades/FacadeHelper.php on line 293
It seems its getting stuck on PayerRef which is the fist value in the result.
What is really odd, is that on the API Explorer when we run the same query it returns a much smaller set of data (itdoes not include the 'PayerRef' value) and if we then post that data back in the API explorer (in the update section) it works fine. This is the results from API explorer
{
"QueryResponse": {
"Bill": [
{
"DueDate": "2020-10-22",
"Balance": 89.59,
"HomeBalance": 89.59,
"domain": "QBO",
"sparse": false,
"Id": "282835",
"SyncToken": "0",
"MetaData": {
"CreateTime": "2020-10-22T14:40:58-07:00",
"LastUpdatedTime": "2020-10-22T14:40:58-07:00"
},
"DocNumber": "150577",
"TxnDate": "2020-10-22",
"CurrencyRef": {
"value": "CAD",
"name": "Canadian Dollar"
},
"ExchangeRate": 1,
"Line": [
{
"Id": "1",
"LineNum": 1,
"Amount": 54.02,
"LinkedTxn": [],
"DetailType": "AccountBasedExpenseLineDetail",
"AccountBasedExpenseLineDetail": {
"AccountRef": {
"value": "40",
"name": "Purchases"
},
"BillableStatus": "NotBillable",
"TaxCodeRef": {
"value": "22"
}
}
},
{
"Id": "2",
"LineNum": 2,
"Amount": 23.88,
"LinkedTxn": [],
"DetailType": "AccountBasedExpenseLineDetail",
"AccountBasedExpenseLineDetail": {
"AccountRef": {
"value": "37",
"name": "Shipping"
},
"BillableStatus": "NotBillable",
"TaxCodeRef": {
"value": "22"
}
}
},
{
"Id": "3",
"LineNum": 3,
"Amount": 0,
"LinkedTxn": [],
"DetailType": "AccountBasedExpenseLineDetail",
"AccountBasedExpenseLineDetail": {
"AccountRef": {
"value": "94",
"name": "otherFees"
},
"BillableStatus": "NotBillable",
"TaxCodeRef": {
"value": "22"
}
}
}
],
"TxnTaxDetail": {
"TotalTax": 11.69,
"TaxLine": [
{
"Amount": 11.69,
"DetailType": "TaxLineDetail",
"TaxLineDetail": {
"TaxRateRef": {
"value": "37"
},
"PercentBased": true,
"TaxPercent": 15,
"NetAmountTaxable": 77.9
}
}
]
},
"VendorRef": {
"value": "156",
"name": "vendora"
},
"APAccountRef": {
"value": "46",
"name": "Accounts Payable (A/P)"
},
"TotalAmt": 89.59,
"GlobalTaxCalculation": "TaxExcluded"
}
],
"startPosition": 1,
"maxResults": 1,
"totalCount": 1
},
"time": "2020-11-22T10:01:06.526-08:00"
}
So, what is the reason for this error? Is it because the data set is unexpected and if so how do we return the same data set that appears in the API Explorer?
Thank you
I have an API which I'm trying to get an ID from, but the output is a mutli-dimensional array and I can't grab just the ID.
This is what the array looks like:
Array ( [{ data] => [ { account_key [ is_owner] => true [ id] => 1 [ name] => test [ display_name] => test [ balance] => 0 [ paid_to_date] => 0 [ updated_at] => 1577724986 [ archived_at] => null [ address1] => [ address2] => [ city] => [ state] => [ postal_code] => [ country_id] => 0 [ work_phone] => [ private_notes] => [ public_notes] => [ last_login] => [ website] => [ industry_id] => 0 [ size_id] => 0 [ is_deleted] => false [ payment_terms] => 30 [ vat_number] => [ id_number] => [ language_id] => 0 [ currency_id] => 0 [ custom_value1] => [ custom_value2] => [ invoice_number_counter] => 1 [ quote_number_counter] => 1 [ task_rate] => 0 [ shipping_address1] => [ shipping_address2] => [ shipping_city] => [ shipping_state] => [ shipping_postal_code] => [ shipping_country_id] => 0 [ show_tasks_in_portal] => true [ send_reminders] => true [ credit_number_counter] => 1 [ custom_messages] => {} [ contacts] => [ { account_key [ is_owner] => true [ id] => 1 [ first_name] => test [ last_name] => test [ email] => me#idontlikespam.com [ contact_key] => mq1dzpkqznfgtqwhdwt9nte1ohmvsju1 [ updated_at] => 1577724986 [ archived_at] => null [ is_primary] => true [ phone] => [ last_login] => [ send_invoice] => true [ custom_value1] => [ custom_value2] => } ] } ] [ meta] => { pagination [ count] => 1 [ per_page] => 15 [ current_page] => 1 [ total_pages] => 1 [ links] => [] } } } )
This is the code I have so far to split it out:
$clients = str_replace('"', "", $clients);
$convert_to_array = explode(',', $clients);
for($i=0; $i < count($convert_to_array ); $i++){
$key_value = explode(':', $convert_to_array [$i]);
$end_array[$key_value [0]] = $key_value [1];
}
print_r($end_array);
foreach ($end_array as $key => $item)
{
echo "[" . $key . "] => " . $item . "<br />";
if ($key = ' id')
{
echo $item;
}
}
It's just the final step I'm missing, it's probably something easy, but I'm still running on a Christmas brain...
New data:
stdClass Object ( [data] => Array ( [0] => stdClass Object ( [account_key] => jvg7qgtw2btrlmpigrq2zpco48eegxvv [is_owner] => 1 [id] => 1 [name] => test [display_name] => test [balance] => 0 [paid_to_date] => 0 [updated_at] => 1577724986 [archived_at] => [address1] => [address2] => [city] => [state] => [postal_code] => [country_id] => 0 [work_phone] => [private_notes] => [public_notes] => [last_login] => [website] => [industry_id] => 0 [size_id] => 0 [is_deleted] => [payment_terms] => 30 [vat_number] => [id_number] => [language_id] => 0 [currency_id] => 0 [custom_value1] => [custom_value2] => [invoice_number_counter] => 1 [quote_number_counter] => 1 [task_rate] => 0 [shipping_address1] => [shipping_address2] => [shipping_city] => [shipping_state] => [shipping_postal_code] => [shipping_country_id] => 0 [show_tasks_in_portal] => 1 [send_reminders] => 1 [credit_number_counter] => 1 [custom_messages] => {} [contacts] => Array ( [0] => stdClass Object ( [account_key] => jvg7qgtw2btrlmpigrq2zpco48eegxvv [is_owner] => 1 [id] => 1 [first_name] => test [last_name] => test [email] => ema#il.co.uk [contact_key] => mq1dzpkqznfgtqwhdwt9nte1ohmvsju1 [updated_at] => 1577724986 [archived_at] => [is_primary] => 1 [phone] => [last_login] => [send_invoice] => 1 [custom_value1] => [custom_value2] => ) ) ) ) [meta] => stdClass Object ( [pagination] => stdClass Object ( [total] => 1 [count] => 1 [per_page] => 15 [current_page] => 1 [total_pages] => 1 [links] => Array ( ) ) ) )
In Array you can access to values by [index].
In stdObject you can access to properties by -> because it is object.
So
stdClass Object ( [data] => Array ( [0] => stdClass Object ( [account_key]
Is
Object->(property data has value array)[index 0 in array and is object]->(property account_key)
On your data you need this.
foreach ($end_array->data as $key => $item)
{
echo $item->id . "<br />";
}
or if you know if data can have always one item you can access with this shortcut
echo $end_array->data[0]->id;
I am trying to create events in my calendar via the calendar API.
Below is the object I am pushing to the API:
Google_Event Object
(
[__creatorType:protected] => Google_EventCreator
[__creatorDataType:protected] =>
[creator] => Google_EventCreator Object
(
[self] => 1
[displayName] =>
[email] => gcalevent#golden-hook-134443.iam.gserviceaccount.com
[id] =>
)
[__organizerType:protected] => Google_EventOrganizer
[__organizerDataType:protected] =>
[organizer] => Google_EventOrganizer Object
(
[self] => 1
[displayName] =>
[email] => gcalevent#golden-hook-134443.iam.gserviceaccount.com
[id] =>
)
[summary] => Hair: Elliot Test
[id] => 421a880v7dqb97p5voqsp198ac
[__attendeesType:protected] => Google_EventAttendee
[__attendeesDataType:protected] => array
[attendees] => Array
(
[0] => Google_EventAttendee Object
(
[comment] =>
[displayName] => Elliot Test
[responseStatus] => accepted
[self] =>
[id] =>
[additionalGuests] =>
[resource] =>
[organizer] =>
[optional] =>
[email] => hello#elliot.co.uk
)
)
[htmlLink] => https://www.google.com/calendar/event?eid=NDIxYTg4MHY3ZHFiOTdwNXZvcXNwMTk4YWMgZ2NhbGV2ZW50QGdvbGRlbi1ob29rLTE2NDQyMS5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbQ
[recurrence] =>
[__startType:protected] => Google_EventDateTime
[__startDataType:protected] =>
[start] => Google_EventDateTime Object
(
[date] =>
[timeZone] =>
[dateTime] => 2019-09-10T15:00:00Z
)
[etag] => "3136239546092000"
[location] =>
[recurringEventId] =>
[__gadgetType:protected] => Google_EventGadget
[__gadgetDataType:protected] =>
[gadget] =>
[status] => confirmed
[updated] => 2019-09-10T12:49:33.046Z
[description] => Price: £10.00
Services: Testing
[iCalUID] => 421a880v7dqb97p5voqsp198ac#google.com
[__extendedPropertiesType:protected] => Google_EventExtendedProperties
[__extendedPropertiesDataType:protected] =>
[extendedProperties] =>
[endTimeUnspecified] =>
[sequence] => 0
[visibility] =>
[guestsCanModify] =>
[__endType:protected] => Google_EventDateTime
[__endDataType:protected] =>
[end] => Google_EventDateTime Object
(
[date] =>
[timeZone] =>
[dateTime] => 2019-09-10T16:00:00Z
)
[attendeesOmitted] =>
[kind] => calendar#event
[locked] =>
[created] => 2019-09-10T12:49:33.000Z
[colorId] =>
[anyoneCanAddSelf] =>
[__remindersType:protected] => Google_EventReminders
[__remindersDataType:protected] =>
[reminders] => Google_EventReminders Object
(
[__overridesType:protected] => Google_EventReminder
[__overridesDataType:protected] => array
[overrides] =>
[useDefault] => 1
)
[guestsCanSeeOtherGuests] =>
[__originalStartTimeType:protected] => Google_EventDateTime
[__originalStartTimeDataType:protected] =>
[originalStartTime] =>
[guestsCanInviteOthers] =>
[transparency] =>
[privateCopy] =>
)
Which appears to be work fine, however when I go to retrieve that event using the ID: 421a880v7dqb97p5voqsp198ac it shows all the above details but the status is marked as "cancelled" and therefore it isn't showing in my calendar:
{
"kind": "calendar#event",
"etag": "\"3136239559346000\"",
"id": "421a880v7dqb97p5voqsp198ac",
"status": "cancelled",
"htmlLink": "https://www.google.com/calendar/event?eid=NDIxYTg4MHY3ZHFiOTdwNXZvcXNwMTk4YWMgaGVsbG9AZWxsaW90cmVldmUuY28udWs",
"created": "2019-09-10T12:49:33.000Z",
"updated": "2019-09-10T12:49:39.673Z",
"summary": "Hair: Elliot Test",
"description": "Price: £10.00\nSerivices: Testing",
"creator": {
"email": "gcalevent#golden-hook-134443.iam.gserviceaccount.com"
},
"organizer": {
"email": "gcalevent#golden-hook-134443.iam.gserviceaccount.com"
},
"start": {
"dateTime": "2019-09-10T16:00:00+01:00"
},
"end": {
"dateTime": "2019-09-10T17:00:00+01:00"
},
"iCalUID": "421a880v7dqb97p5voqsp198ac#google.com",
"sequence": 0,
"attendees": [
{
"email": "hello#elliot.co.uk",
"displayName": "Elliot Test",
"self": true,
"responseStatus": "accepted"
}
],
"reminders": {
"useDefault": true
}
}
This has previously been working fine for months and is now no longer working without any changes from my side.
Can anyone provide any insight into why this might be happening?
Thanks
I have associative array like -
[0] => Array
(
[date] => 2018-06-22
[id] => 2282991
[type] => VIDEO
[domain] =>
[code] => Austin
[address] => Phone
)
[1] => Array
(
[date] => 2018-06-22
[id] => 2282991
[type] => VIDEO
[domain] =>
[code] =>
[address] => Phone
)
[3] => Array
(
[date] => 2018-06-22
[id] => 2282991
[type] => VIDEO
[domain] =>
[code] => Austin
[address] => Phone
)
I need to check is there any column having all the values are blank.
That means it should return only domain from above array because it is blank everywhere.
Is there any way to do this with minimum use of forloop? I need to check this for all these columns.
This will work if your subarray having same number of keys.Like "Date, id, Type etc".
$array = [
[ "date" => "2018-06-22", "id" => 2282991, "type" => "VIDEO", "domain" =>'', "code" => "Austin", "address" => "Phone"],
[ "date" => "2018-06-22", "id" => 2282991, "type" => "VIDEO", "domain" =>'', "code" => "", "address" => "Phone"],
[ "date" => "2018-06-22", "id" => 2282991, "type" => "VIDEO", "domain" =>'', "code" => "Austin", "address" => "Phone"]
];
$empty = [];
foreach($array[0] as $key=>$val){
$error = array_column($array, $key);
if(empty (array_filter($error)) ) {
$empty[] = $key;
}
}
print_r($empty);
Output:
Array
(
[0] => domain
)