Parsing particular value in JSON via PHP from Mapquest API - php

I am having trouble targeting the particular value in the array. I am trying to target the 'lng' and 'lat'. I feel like I'm close, and have tried several different ways to target. Currently trying this:
$json = file_get_contents($jsonurl);
$output = json_decode($json, true);
$latitude=$output['results']['locations']['latLng'][0];
$longitude=$output['results']['locations']['latLng'][1];
The JSON is:
array(3) {
["results"]=>
array(1) {
[0]=>
array(2) {
["locations"]=>
array(1) {
[0]=>
array(19) {
["latLng"]=>
array(2) {
["lng"]=>
float(-122.5008)
["lat"]=>
float(47.2629)
}
["adminArea4"]=>
string(13) "Pierce County"
["adminArea5Type"]=>
string(4) "City"
["adminArea4Type"]=>
string(6) "County"
["adminArea5"]=>
string(6) "Tacoma"
["street"]=>
string(0) ""
["adminArea1"]=>
string(2) "US"
["adminArea3"]=>
string(2) "WA"
["type"]=>
string(1) "s"
["displayLatLng"]=>
array(2) {
["lng"]=>
float(-122.5008)
["lat"]=>
float(47.2629)
}
["linkId"]=>
int(0)
["postalCode"]=>
string(5) "98406"
["sideOfStreet"]=>
string(1) "N"
["dragPoint"]=>
bool(false)
["adminArea1Type"]=>
string(7) "Country"
["geocodeQuality"]=>
string(3) "ZIP"
["geocodeQualityCode"]=>
string(5) "Z1XAA"
["mapUrl"]=>
string(186) "http://www.mapquestapi.com/staticmap/v4/getmap?key=Fmjtd|luub2gu2ll,7w=o5-9uaauz&type=map&size=225,160&pois=purple-1,47.2629,-122.5008,0,0|&center=47.2629,-122.5008&zoom=12&rand=-8386350"
["adminArea3Type"]=>
string(5) "State"
}
}
["providedLocation"]=>
array(1) {
["location"]=>
string(5) "98406"
}
}
}
["options"]=>
array(3) {
["ignoreLatLngInput"]=>
bool(false)
["maxResults"]=>
int(-1)
["thumbMaps"]=>
bool(true)
}
["info"]=>
array(3) {
["copyright"]=>
array(3) {
["text"]=>
string(22) "© 2013 MapQuest, Inc."
["imageUrl"]=>
string(35) "http://api.mqcdn.com/res/mqlogo.gif"
["imageAltText"]=>
string(22) "© 2013 MapQuest, Inc."
}
["statuscode"]=>
int(0)
["messages"]=>
array(0) {
}
}
}

Try
$latitude=$output['results'][0]['locations'][0]['latLng']['lat'];
$longitude=$output['results'][0]['locations'][0]['latLng']['lng'];

Related

How to loop through an array of objects and get the values from a specific object?

Basically I have an array of objects that I've managed to dump. I'm trying to figure out how I can get the values from the [options] object from a set objects and store them in an array
array(4) {
["size"]=>
object(WC_Product_Attribute)#2724 (1) {
["data":protected]=>
array(6) {
["id"]=>
int(0)
["name"]=>
string(4) "Size"
["options"]=>
array(3) {
[0]=>
string(6) "400 ml"
[1]=>
string(2) "1L"
[2]=>
string(2) "2L"
}
["position"]=>
int(0)
["visible"]=>
bool(true)
["variation"]=>
bool(false)
}
}
["fruit"]=>
object(WC_Product_Attribute)#2723 (1) {
["data":protected]=>
array(6) {
["id"]=>
int(0)
["name"]=>
string(5) "Fruit"
["options"]=>
array(8) {
[0]=>
string(17) "100% Orange Juice"
[1]=>
string(5) "Apple"
[2]=>
string(4) "Pear"
[3]=>
string(9) "Pineapple"
[4]=>
string(12) "Passionfruit"
[5]=>
string(15) "Red Dragonfruit"
[6]=>
string(13) "Baobab Powder"
[7]=>
string(17) "Grapeseed Extract"
}
["position"]=>
int(1)
["visible"]=>
bool(true)
["variation"]=>
bool(false)
}
}
["good-source-of-vit-c"]=>
object(WC_Product_Attribute)#2722 (1) {
["data":protected]=>
array(6) {
["id"]=>
int(0)
["name"]=>
string(20) "Good Source of Vit C"
["options"]=>
array(1) {
[0]=>
string(3) "Yes"
}
["position"]=>
int(2)
["visible"]=>
bool(true)
["variation"]=>
bool(false)
}
}
["fiber"]=>
object(WC_Product_Attribute)#2721 (1) {
["data":protected]=>
array(6) {
["id"]=>
int(0)
["name"]=>
string(5) "Fiber"
["options"]=>
array(1) {
[0]=>
string(3) "Yes"
}
["position"]=>
int(3)
["visible"]=>
bool(true)
["variation"]=>
bool(false)
}
}
}
I've tried doing a foreach to loop through each object but I've stumbled upon an error.
foreach ($productsArray as $i => $value) {
echo $value->options;
}
My objective is to get all the values from the [options] object store them in an array to be used.
From what I can see you are iterating over an array of WC_Product_Attribute objects and that's a sign of WooCommerce usage, isn't it?
In that case there is a getter method available to get options from a Product Attribute:
foreach ($productsArray as $i => $value) {
var_dump( $value->get_options() );
}
More in the docs

How to access array value and place into string

i have put a returned API object response into an array but now i want to access the array data, i get undefined index, this is my code.
$paystack = new Yabacon\Paystack('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
$trx = $paystack->transactions(["perPage"=>1, "amount"=>10000, "status"=>"success"]); //RETURNED OBJECT
$array = (array) $trx; //CONVERTED FROM OBJECT TO ARRAY.
When I var_dump( (array) $trx ); i get
array(4) { ["status"]=> bool(true) ["message"]=> string(22) "Transactions retrieved" ["data"]=> array(1) { [0]=> object(stdClass)#21 (22) { ["id"]=> int(901742) ["domain"]=> string(4) "test" ["status"]=> string(7) "success" ["reference"]=> string(13) "58c0e61ca5cce" ["amount"]=> int(10000) ["message"]=> NULL ["gateway_response"]=> string(10) "Successful" ["paid_at"]=> string(24) "2017-03-08T22:48:33.000Z" ["created_at"]=> string(24) "2017-03-08T22:48:11.000Z" ["channel"]=> string(4) "card" ["currency"]=> string(3) "NGN" ["ip_address"]=> string(14) "xxx.xxx.xxx.xxx" ["metadata"]=> object(stdClass)#23 (2) { ["custom_fields"]=> array(1) { [0]=> object(stdClass)#22 (3) { ["display_name"]=> string(13) "Mobile Number" ["variable_name"]=> string(13) "mobile_number" ["value"]=> string(14) "+xxxxxxxxxxxxx" } } ["referrer"]=> string(27) "http://localhost/b/checkout" } ["log"]=> object(stdClass)#24 (9) { ["time_spent"]=> int(24) ["attempts"]=> int(1) ["authentication"]=> NULL ["errors"]=> int(0) ["success"]=> bool(true) ["mobile"]=> bool(false) ["input"]=> array(0) { } ["channel"]=> NULL ["history"]=> array(4) { [0]=> object(stdClass)#25 (3) { ["type"]=> string(5) "input" ["message"]=> string(55) "Filled these fields: card number, card expiry, card cvv" ["time"]=> int(20) } [1]=> object(stdClass)#26 (3) { ["type"]=> string(6) "action" ["message"]=> string(16) "Attempted to pay" ["time"]=> int(20) } [2]=> object(stdClass)#27 (3) { ["type"]=> string(7) "success" ["message"]=> string(17) "Successfully paid" ["time"]=> int(22) } [3]=> object(stdClass)#28 (3) { ["type"]=> string(5) "close" ["message"]=> string(11) "Page closed" ["time"]=> int(24) } } } ["fees"]=> int(150) ["fees_split"]=> NULL ["customer"]=> object(stdClass)#29 (8) { ["id"]=> int(102185) ["first_name"]=> string(0) "" ["last_name"]=> string(0) "" ["email"]=> string(23) "xxxxxxxxxx#gmail.com" ["customer_code"]=> string(19) "CUS_xxxxxxxxxxx" ["phone"]=> string(0) "" ["metadata"]=> NULL ["risk_action"]=> string(7) "default" } ["authorization"]=> object(stdClass)#30 (12) { ["authorization_code"]=> string(15) "AUTH_xxxxxxxxx" ["bin"]=> string(6) "412345" ["last4"]=> string(4) "1381" ["exp_month"]=> string(2) "01" ["exp_year"]=> string(4) "2020" ["channel"]=> string(4) "card" ["card_type"]=> string(4) "visa" ["bank"]=> string(9) "TEST BANK" ["country_code"]=> string(2) "NG" ["brand"]=> string(4) "visa" ["reusable"]=> bool(true) ["signature"]=> string(24) "SIG_xxxxxxxxxxxx" } ["plan"]=> object(stdClass)#31 (0) { } ["subaccount"]=> object(stdClass)#32 (0) { } ["paidAt"]=> string(24) "2017-03-08T22:48:33.000Z" ["createdAt"]=> string(24) "2017-03-08T22:48:11.000Z" } } ["meta"]=> object(stdClass)#33 (6) { ["total"]=> int(6) ["total_volume"]=> int(60000) ["skipped"]=> int(0) ["perPage"]=> string(1) "1" ["page"]=> int(1) ["pageCount"]=> int(6) } }
What I want to do is, I want to get it in this format
$stats = $array['data']['status'];
$order_id = $array['data']['id'];
$transaction_method = $array['data']['channel'];
$currency = $array['data']['currency'];
$reference = $array['data']['reference'];
$final_price = $array['data']['amount'];
$email_send = $array['data']['customer']['email'];
$day_paid = $array['data']['paid_at'];
$referring_page = $array['data']['metadata']['referrer'];
But when i ECHO any variable out e.g i do echo $stats OR echo $order_id i get
Notice: Undefined index: status in C:\xampp\htdocs\b\d\paystackorders.php on line 150
Notice: Undefined index: id in C:\xampp\htdocs\b\d\paystackorders.php on line 151.
How do i go around resolving this.
It needs to be $array['data'][0]['status']
and $array['data'][0]['id']
and so on...
This is because $array['data'] is an array of objects
The best way to go in my opinion is as follows:
$data = $array['data'][0];
And then access what you want :
$status = $data['status'];
$order_id = $data['id'];

PHP: Call to undefined method in Google Play Developer API

I'm going to get list of my in-app products from using google API, by its PHP client from a remote server.
Here is my code:
$client = new Google_Client();
$client->setClientId($client_id);
$client->setClientSecret($client_secret);
$client->setRedirectUri($redirect_uri);
$client->addScope("https://www.googleapis.com/auth/androidpublisher");
$service = new Google_Service_AndroidPublisher($client);
$optParams = array('token' => 'my token....');
$results = $service->inappproducts->list ('my.package.name', $optParams);
When I run this code I get the following error:
Fatal error: Call to undefined method Google_Service_AndroidPublisher_Inappproducts_Resource::list()
I implemented my code based on some samples and details listed in api reference. I just brought var_dump of $service->inappproducts for your reference:
object(Google_Service_AndroidPublisher_Inappproducts_Resource)#14 (7) { ["stackParameters":"Google_Service_Resource":private]=> array(10) { ["alt"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["fields"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["trace"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["userIp"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["quotaUser"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["data"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(4) "body" } ["mimeType"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(6) "header" } ["uploadType"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } ["mediaUpload"]=> array(2) { ["type"]=> string(7) "complex" ["location"]=> string(5) "query" } ["prettyPrint"]=> array(2) { ["type"]=> string(6) "string" ["location"]=> string(5) "query" } } ["rootUrl":"Google_Service_Resource":private]=> string(27) "https://www.googleapis.com/" ["client":"Google_Service_Resource":private]=> object(Google_Client)#1 (9) { ["auth":"Google_Client":private]=> NULL ["io":"Google_Client":private]=> NULL ["cache":"Google_Client":private]=> NULL ["config":"Google_Client":private]=> object(Google_Config)#2 (1) { ["configuration":protected]=> array(7) { ["application_name"]=> string(0) "" ["auth_class"]=> string(18) "Google_Auth_OAuth2" ["io_class"]=> string(14) "Google_IO_Curl" ["cache_class"]=> string(17) "Google_Cache_File" ["logger_class"]=> string(18) "Google_Logger_Null" ["base_path"]=> string(26) "https://www.googleapis.com" ["classes"]=> array(10) { ["Google_IO_Abstract"]=> array(1) { ["request_timeout_seconds"]=> int(100) } ["Google_IO_Curl"]=> array(2) { ["disable_proxy_workaround"]=> bool(false) ["options"]=> NULL } ["Google_Logger_Abstract"]=> array(4) { ["level"]=> string(5) "debug" ["log_format"]=> string(42) "[%datetime%] %level%: %message% %context% " ["date_format"]=> string(13) "d/M/Y:H:i:s O" ["allow_newlines"]=> bool(true) } ["Google_Logger_File"]=> array(3) { ["file"]=> string(12) "php://stdout" ["mode"]=> int(416) ["lock"]=> bool(false) } ["Google_Http_Request"]=> array(2) { ["disable_gzip"]=> bool(false) ["enable_gzip_for_uploads"]=> bool(false) } ["Google_Auth_OAuth2"]=> array(13) { ["client_id"]=> string(71) "" ["client_secret"]=> string(24) "" ["redirect_uri"]=> string(42) "https://android-e1test.rhcloud.com/verify/" ["developer_key"]=> string(0) "" ["hd"]=> string(0) "" ["prompt"]=> string(0) "" ["openid.realm"]=> string(0) "" ["include_granted_scopes"]=> string(0) "" ["login_hint"]=> string(0) "" ["request_visible_actions"]=> string(0) "" ["access_type"]=> string(6) "online" ["approval_prompt"]=> string(4) "auto" ["federated_signon_certs_url"]=> string(42) "https://www.googleapis.com/oauth2/v1/certs" } ["Google_Task_Runner"]=> array(5) { ["initial_delay"]=> int(1) ["max_delay"]=> int(60) ["factor"]=> int(2) ["jitter"]=> float(0.5) ["retries"]=> int(0) } ["Google_Service_Exception"]=> array(1) { ["retry_map"]=> array(4) { [500]=> int(-1) [503]=> int(-1) ["rateLimitExceeded"]=> int(-1) ["userRateLimitExceeded"]=> int(-1) } } ["Google_IO_Exception"]=> array(1) { ["retry_map"]=> array(5) { [6]=> int(-1) [7]=> int(-1) [28]=> int(-1) [35]=> int(-1) [52]=> int(-1) } } ["Google_Cache_File"]=> array(1) { ["directory"]=> string(18) "/tmp/Google_Client" } } } } ["logger":"Google_Client":private]=> NULL ["deferExecution":"Google_Client":private]=> bool(false) ["requestedScopes":protected]=> array(1) { [0]=> string(48) "https://www.googleapis.com/auth/androidpublisher" } ["services":protected]=> array(0) { } ["authenticated":"Google_Client":private]=> bool(false) } ["serviceName":"Google_Service_Resource":private]=> string(16) "androidpublisher" ["servicePath":"Google_Service_Resource":private]=> string(33) "androidpublisher/v2/applications/" ["resourceName":"Google_Service_Resource":private]=> string(13) "inappproducts" ["methods":"Google_Service_Resource":private]=> array(7) { ["batch"]=> array(3) { ["path"]=> string(19) "inappproducts/batch" ["httpMethod"]=> string(4) "POST" ["parameters"]=> array(0) { } } ["delete"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(6) "DELETE" ["parameters"]=> array(2) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } } } ["get"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(3) "GET" ["parameters"]=> array(2) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } } } ["insert"]=> array(3) { ["path"]=> string(27) "{packageName}/inappproducts" ["httpMethod"]=> string(4) "POST" ["parameters"]=> array(2) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["autoConvertMissingPrices"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "boolean" } } } ["list"]=> array(3) { ["path"]=> string(27) "{packageName}/inappproducts" ["httpMethod"]=> string(3) "GET" ["parameters"]=> array(4) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["maxResults"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "integer" } ["startIndex"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "integer" } ["token"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(6) "string" } } } ["patch"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(5) "PATCH" ["parameters"]=> array(3) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["autoConvertMissingPrices"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "boolean" } } } ["update"]=> array(3) { ["path"]=> string(33) "{packageName}/inappproducts/{sku}" ["httpMethod"]=> string(3) "PUT" ["parameters"]=> array(3) { ["packageName"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["sku"]=> array(3) { ["location"]=> string(4) "path" ["type"]=> string(6) "string" ["required"]=> bool(true) } ["autoConvertMissingPrices"]=> array(2) { ["location"]=> string(5) "query" ["type"]=> string(7) "boolean" } } } } }
I'm shooting from the hip here, but try this:
$results = $service->inappproducts->listInappproducts('my.package.name', $optParams);
Instead of:
$results = $service->inappproducts->list ('my.package.name', $optParams);
And as I commented, you should change your client secret, since it looks like you posted in your var_dump there.

Echo array with json_decode gives too many echoes

I do get the strings I intend to. But I also get the first letter (or number) of the other data in the json file.
E.g. I would like to have or should get the result:
/Barrafina
Exceptional cooking here. Such simple but amazing dishes. Highly recommend the crab croquettes, lambs kidneys, skewers and the brain. Sherries are also superb here.
Matt Ta-Min/
But instead I get
/Barrafina
ee
Exceptional cooking here. Such simple but amazing dishes. Highly recommend the crab croquettes, lambs kidneys, skewers and the brain. Sherries are also superb here.
5 5 E Eu uh h
Matt Ta-Min
/
What did I do wrong? here is the code:
(If you have time and energy to look the JSON you will see from where eg. 5 5 E Eu uh h comes.)
I appreciate any help.
<?php
$client_id = 'CLIENT_ID';
$client_secret = 'SECRET';
$request_date = date('Ymd');
$base_url = 'https://api.foursquare.com/v2/';
$endpoint = 'venues/explore?';
$params = 'near=London&limit=3&section=food&radius=1000';
$auth = "&client_id=$client_id&client_secret=$client_secret&v=$request_date";
$url = $base_url.$endpoint.$params.$auth;
$results = file_get_contents($url);
$json_results = json_decode($results,true);
//var_dump($json_results);
$items0 = $json_results['response']['groups']['0']['items']['0'];
$items1 = $json_results['response']['groups']['0']['items']['0']['tips'];
$items2 = $json_results['response']['groups']['0']['items']['0']['tips']['0'];
//<div style="align:center;">
foreach ( $items0+$items1 as $item){
echo '<li>';
echo $item['name'];
echo $item['text'];
}
foreach ( $items2 as $item){
print $item['firstName']; print '&nbsp'; print $item['lastName'];
}
HERE is the json decoded:
array(2) { ["meta"]=> array(2) { ["code"]=> int(200) ["requestId"]=> string(24) "55fb1f91498e70ad2e246eed" } ["response"]=> array(10) { ["suggestedFilters"]=> array(2) { ["header"]=> string(12) "Tap to show:" ["filters"]=> array(2) { [0]=> array(2) { ["name"]=> string(13) "With specials" ["key"]=> string(8) "specials" } [1]=> array(2) { ["name"]=> string(8) "Open now" ["key"]=> string(7) "openNow" } } } ["geocode"]=> array(8) { ["what"]=> string(0) "" ["where"]=> string(6) "london" ["center"]=> array(2) { ["lat"]=> float(51.50853) ["lng"]=> float(-0.12574) } ["displayString"]=> string(38) "London, Greater London, United Kingdom" ["cc"]=> string(2) "GB" ["geometry"]=> array(1) { ["bounds"]=> array(2) { ["ne"]=> array(2) { ["lat"]=> float(51.691643999656) ["lng"]=> float(0.33418999705203) } ["sw"]=> array(2) { ["lat"]=> float(51.284674044171) ["lng"]=> float(-0.50855792793694) } } } ["slug"]=> string(6) "london" ["longId"]=> string(17) "72057594040571679" } ["warning"]=> array(1) { ["text"]=> string(114) "There aren't a lot of results near you. Try something more general, reset your filters, or expand the search area." } ["headerLocation"]=> string(6) "London" ["headerFullLocation"]=> string(6) "London" ["headerLocationGranularity"]=> string(4) "city" ["query"]=> string(4) "food" ["totalResults"]=> int(246) ["suggestedBounds"]=> array(2) { ["ne"]=> array(2) { ["lat"]=> float(51.510800358799) ["lng"]=> float(-0.12174369837641) } ["sw"]=> array(2) { ["lat"]=> float(51.508100699014) ["lng"]=> float(-0.13015278468604) } } ["groups"]=> array(1) { [0]=> array(3) { ["type"]=> string(18) "Recommended Places" ["name"]=> string(11) "recommended" ["items"]=> array(1) { [0]=> array(4) { ["reasons"]=> array(2) { ["count"]=> int(0) ["items"]=> array(1) { [0]=> array(3) { ["summary"]=> string(20) "This spot is popular" ["type"]=> string(7) "general" ["reasonName"]=> string(23) "globalInteractionReason" } } } ["venue"]=> array(17) { ["id"]=> string(24) "53bab96d498e7e355fb53d6c" ["name"]=> string(9) "Barrafina" ["contact"]=> array(6) { ["phone"]=> string(13) "+442074401456" ["formattedPhone"]=> string(16) "+44 20 7440 1456" ["twitter"]=> string(13) "barrafinaadst" ["facebook"]=> string(15) "705351912878392" ["facebookUsername"]=> string(23) "BarrafinaAdelaideStreet" ["facebookName"]=> string(25) "Barrafina Adelaide Street" } ["location"]=> array(10) { ["address"]=> string(14) "10 Adelaide St" ["crossStreet"]=> string(13) "William IV St" ["lat"]=> float(51.509450528906) ["lng"]=> float(-0.12594824153122) ["postalCode"]=> string(8) "WC2N 4HZ" ["cc"]=> string(2) "GB" ["city"]=> string(6) "London" ["state"]=> string(14) "Greater London" ["country"]=> string(14) "United Kingdom" ["formattedAddress"]=> array(5) { [0]=> string(30) "10 Adelaide St (William IV St)" [1]=> string(6) "London" [2]=> string(14) "Greater London" [3]=> string(8) "WC2N 4HZ" [4]=> string(14) "United Kingdom" } } ["categories"]=> array(1) { [0]=> array(6) { ["id"]=> string(24) "4bf58dd8d48988d150941735" ["name"]=> string(18) "Spanish Restaurant" ["pluralName"]=> string(19) "Spanish Restaurants" ["shortName"]=> string(7) "Spanish" ["icon"]=> array(2) { ["prefix"]=> string(52) "https://ss3.4sqi.net/img/categories_v2/food/spanish_" ["suffix"]=> string(4) ".png" } ["primary"]=> bool(true) } } ["verified"]=> bool(false) ["stats"]=> array(3) { ["checkinsCount"]=> int(357) ["usersCount"]=> int(278) ["tipCount"]=> int(26) } ["url"]=> string(22) "http://barrafina.co.uk" ["price"]=> array(3) { ["tier"]=> int(2) ["message"]=> string(8) "Moderate" ["currency"]=> string(2) "£" } ["rating"]=> float(9) ["ratingColor"]=> string(6) "00B551" ["ratingSignals"]=> int(80) ["allowMenuUrlEdit"]=> bool(true) ["hours"]=> array(2) { ["status"]=> string(19) "Open until 11:00 PM" ["isOpen"]=> bool(true) } ["specials"]=> array(2) { ["count"]=> int(0) ["items"]=> array(0) { } } ["photos"]=> array(2) { ["count"]=> int(31) ["groups"]=> array(0) { } } ["hereNow"]=> array(3) { ["count"]=> int(0) ["summary"]=> string(11) "Nobody here" ["groups"]=> array(0) { } } } ["tips"]=> array(1) { [0]=> array(9) { ["id"]=> string(24) "55db9142498ede18f5b31b81" ["createdAt"]=> int(1440452930) ["text"]=> string(164) "Exceptional cooking here. Such simple but amazing dishes. Highly recommend the crab croquettes, lambs kidneys, skewers and the brain. Sherries are also superb here." ["type"]=> string(4) "user" ["canonicalUrl"]=> string(52) "https://foursquare.com/item/55db9142498ede18f5b31b81" ["likes"]=> array(3) { ["count"]=> int(2) ["groups"]=> array(0) { } ["summary"]=> string(7) "2 likes" } ["logView"]=> bool(true) ["todo"]=> array(1) { ["count"]=> int(0) } ["user"]=> array(5) { ["id"]=> string(8) "98683884" ["firstName"]=> string(4) "Matt" ["lastName"]=> string(6) "Ta-Min" ["gender"]=> string(4) "male" ["photo"]=> array(2) { ["prefix"]=> string(31) "https://irs1.4sqi.net/img/user/" ["suffix"]=> string(30) "/98683884-1MJ0OTISTPZWSBRJ.jpg" } } } } ["referralId"]=> string(30) "e-3-53bab96d498e7e355fb53d6c-0" } } } } } }
Here is JSON
{"meta":{"code":200,"requestId":"55fbde58498e7fdbd12f8fb2"},"response":{"suggestedFilters":{"header":"Tap to show:","filters":[{"name":"With specials","key":"specials"},{"name":"Open now","key":"openNow"}]},"geocode":{"what":"","where":"london","center":{"lat":51.50853,"lng":-0.12574},"displayString":"London, Greater London, United Kingdom","cc":"GB","geometry":{"bounds":{"ne":{"lat":51.691643999655895,"lng":0.33418999705203406},"sw":{"lat":51.28467404417054,"lng":-0.5085579279369435}}},"slug":"london","longId":"72057594040571679"},"warning":{"text":"There aren't a lot of results near you. Try something more general, reset your filters, or expand the search area."},"headerLocation":"London","headerFullLocation":"London","headerLocationGranularity":"city","query":"food","totalResults":246,"suggestedBounds":{"ne":{"lat":51.5108003587992,"lng":-0.12174369837640672},"sw":{"lat":51.50810069901375,"lng":-0.1301527846860385}},"groups":[{"type":"Recommended Places","name":"recommended","items":[{"reasons":{"count":0,"items":[{"summary":"This spot is popular","type":"general","reasonName":"globalInteractionReason"}]},"venue":{"id":"53bab96d498e7e355fb53d6c","name":"Barrafina","contact":{"phone":"+442074401456","formattedPhone":"+44 20 7440 1456","twitter":"barrafinaadst","facebook":"705351912878392","facebookUsername":"BarrafinaAdelaideStreet","facebookName":"Barrafina Adelaide Street"},"location":{"address":"10 Adelaide St","crossStreet":"William IV St","lat":51.50945052890648,"lng":-0.1259482415312226,"postalCode":"WC2N 4HZ","cc":"GB","city":"London","state":"Greater London","country":"United Kingdom","formattedAddress":["10 Adelaide St (William IV St)","London","Greater London","WC2N 4HZ","United Kingdom"]},"categories":[{"id":"4bf58dd8d48988d150941735","name":"Spanish Restaurant","pluralName":"Spanish Restaurants","shortName":"Spanish","icon":{"prefix":"https:\/\/ss3.4sqi.net\/img\/categories_v2\/food\/spanish_","suffix":".png"},"primary":true}],"verified":false,"stats":{"checkinsCount":357,"usersCount":278,"tipCount":26},"url":"http:\/\/barrafina.co.uk","rating":9.0,"ratingColor":"00B551","ratingSignals":80,"allowMenuUrlEdit":true,"hours":{"status":"Closed until Noon","isOpen":false},"specials":{"count":0,"items":[]},"photos":{"count":31,"groups":[]},"hereNow":{"count":0,"summary":"Nobody here","groups":[]}},"tips":[{"id":"55db9142498ede18f5b31b81","createdAt":1440452930,"text":"Exceptional cooking here. Such simple but amazing dishes. Highly recommend the crab croquettes, lambs kidneys, skewers and the brain. Sherries are also superb here.","type":"user","canonicalUrl":"https:\/\/foursquare.com\/item\/55db9142498ede18f5b31b81","likes":{"count":2,"groups":[],"summary":"2 likes"},"logView":true,"todo":{"count":0},"user":{"id":"98683884","firstName":"Matt","lastName":"Ta-Min","gender":"male","photo":{"prefix":"https:\/\/irs1.4sqi.net\/img\/user\/","suffix":"\/98683884-1MJ0OTISTPZWSBRJ.jpg"}}}],"referralId":"e-3-53bab96d498e7e355fb53d6c-0"}]}]}}

After Drupal update show Errors

I've updated a Drupal from version 7.2 to version 7.26.
After do that I've some errors:
throw new EntityMalformedException (Missing bundle property on entity of type taxonomy_term)
It appears in file common . inc:
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
I insert some "echos" to see when is shown this message, and I get this:
var_dump( $info['entity keys']);
array(4) {
["id"]=>
string(3) "tid"
["bundle"]=>
string(23) "vocabulary_machine_name"
["label"]=>
string(4) "name"
["revision"]=>
string(0) ""
}
array(4) {
["id"]=>
string(3) "tid"
["bundle"]=>
string(23) "vocabulary_machine_name"
["label"]=>
string(4) "name"
["revision"]=>
string(0) ""
}
var_dump( $info);
array(22) {
["label"]=>
string(22) "Término de taxonomía"
["controller class"]=>
string(22) "TaxonomyTermController"
["base table"]=>
string(18) "taxonomy_term_data"
["uri callback"]=>
string(17) "taxonomy_term_uri"
["fieldable"]=>
bool(true)
["entity keys"]=>
array(4) {
["id"]=>
string(3) "tid"
["bundle"]=>
string(23) "vocabulary_machine_name"
["label"]=>
string(4) "name"
["revision"]=>
string(0) ""
}
["bundle keys"]=>
array(1) {
["bundle"]=>
string(12) "machine_name"
}
["bundles"]=>
array(3) {
["pais"]=>
array(3) {
["label"]=>
string(7) "Regions"
["admin"]=>
array(4) {
["path"]=>
string(58) "admin/structure/taxonomy/%taxonomy_vocabulary_machine_name"
["real path"]=>
string(29) "admin/structure/taxonomy/pais"
["bundle argument"]=>
int(3)
["access arguments"]=>
array(1) {
[0]=>
string(19) "administer taxonomy"
}
}
["rdf_mapping"]=>
array(5) {
["rdftype"]=>
array(1) {
[0]=>
string(12) "skos:Concept"
}
["name"]=>
array(1) {
["predicates"]=>
array(2) {
[0]=>
string(10) "rdfs:label"
[1]=>
string(14) "skos:prefLabel"
}
}
["description"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(15) "skos:definition"
}
}
["vid"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(13) "skos:inScheme"
}
["type"]=>
string(3) "rel"
}
["parent"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(12) "skos:broader"
}
["type"]=>
string(3) "rel"
}
}
}
["auto_created_voc38877"]=>
array(3) {
["label"]=>
string(10) "Provincias"
["admin"]=>
array(4) {
["path"]=>
string(58) "admin/structure/taxonomy/%taxonomy_vocabulary_machine_name"
["real path"]=>
string(46) "admin/structure/taxonomy/auto_created_voc38877"
["bundle argument"]=>
int(3)
["access arguments"]=>
array(1) {
[0]=>
string(19) "administer taxonomy"
}
}
["rdf_mapping"]=>
array(5) {
["rdftype"]=>
array(1) {
[0]=>
string(12) "skos:Concept"
}
["name"]=>
array(1) {
["predicates"]=>
array(2) {
[0]=>
string(10) "rdfs:label"
[1]=>
string(14) "skos:prefLabel"
}
}
["description"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(15) "skos:definition"
}
}
["vid"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(13) "skos:inScheme"
}
["type"]=>
string(3) "rel"
}
["parent"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(12) "skos:broader"
}
["type"]=>
string(3) "rel"
}
}
}
["busquedas_destacadas_"]=>
array(3) {
["label"]=>
string(21) "Búsquedas destacadas"
["admin"]=>
array(4) {
["path"]=>
string(58) "admin/structure/taxonomy/%taxonomy_vocabulary_machine_name"
["real path"]=>
string(46) "admin/structure/taxonomy/busquedas_destacadas_"
["bundle argument"]=>
int(3)
["access arguments"]=>
array(1) {
[0]=>
string(19) "administer taxonomy"
}
}
["rdf_mapping"]=>
array(5) {
["rdftype"]=>
array(1) {
[0]=>
string(12) "skos:Concept"
}
["name"]=>
array(1) {
["predicates"]=>
array(2) {
[0]=>
string(10) "rdfs:label"
[1]=>
string(14) "skos:prefLabel"
}
}
["description"]=>
array(1) {
["predicates"]=>
array(1) {
[0]=>
string(15) "skos:definition"
}
}
["vid"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(13) "skos:inScheme"
}
["type"]=>
string(3) "rel"
}
["parent"]=>
array(2) {
["predicates"]=>
array(1) {
[0]=>
string(12) "skos:broader"
}
["type"]=>
string(3) "rel"
}
}
}
}
["view modes"]=>
array(1) {
["full"]=>
array(2) {
["label"]=>
string(34) "Página de términos de taxonomía"
["custom settings"]=>
bool(false)
}
}
["static cache"]=>
bool(true)
["field cache"]=>
bool(true)
["load hook"]=>
string(18) "taxonomy_term_load"
["translation"]=>
array(0) {
}
["schema_fields_sql"]=>
array(1) {
["base table"]=>
array(8) {
[0]=>
string(3) "tid"
[1]=>
string(3) "vid"
[2]=>
string(4) "name"
[3]=>
string(11) "description"
[4]=>
string(6) "format"
[5]=>
string(6) "weight"
[6]=>
string(8) "language"
[7]=>
string(9) "i18n_tsid"
}
}
["token type"]=>
string(4) "term"
["access callback"]=>
string(31) "entity_metadata_taxonomy_access"
["creation callback"]=>
string(29) "entity_metadata_create_object"
["save callback"]=>
string(18) "taxonomy_term_save"
["deletion callback"]=>
string(20) "taxonomy_term_delete"
["view callback"]=>
string(27) "entity_metadata_view_single"
["form callback"]=>
string(34) "entity_metadata_form_taxonomy_term"
["configuration"]=>
bool(false)
}
I supposed this is related with something missing in the database. But I can't find it.
Any help, please?
Thanks in advance.

Categories