Fetch protected data from object zend - zend-framework

I have response and I want to fetch referenceId from it, the response is
Application_Model_User Object
(
[_data:protected] => Array
(
[id] => 2
[email] => test#gmail.com
[password] => ef1dca60798e10a51e3b6201ae7c40fbe2a10887
[salt] => 87fc83906190d1e29b60c5813065af068e16459d
[name] => test
[creationDate] => 2011-07-05
[lastTimeStamp] => 2016-06-03 09:13:53
[enabled] => 1
[loginHash] =>
[employeeNumber] => 0007
[userphoneNumber] => +546546546545
[jobTitle] => Business Manager
)
[_references:protected] => Array
(
[role] => Array
(
[referenceClass] => Application_Model_Role
[referenceId] => 4
[mapperClass] => Application_Model_RoleMapper
[mapper] =>
)
[organisation] => Array
(
[referenceClass] => Application_Model_Organisation
[referenceId] => 1
[mapperClass] => Application_Model_OrganisationMapper
[mapper] =>
)
)
)
How can I fetch ?

In .phtml file in ajax after
success: function(response){
var data = jQuery.parseJSON(response);
for (var i in data)
{
var referenceId = data[i]['referenceId'];
}
}

You can use a getter. You can create a method to return the referenceId.

Related

How to modify Mediawiki Login form

I'm trying to add the attribute autocomplete="off" in mediawiki login form. Being completely new, I'm unable to find where the form is being built.
I'm using MediaWiki 1.29.1
Any help would be greatly appreciated.
Things I did to find it:
1. Added the following code in LocalSettings.php
$wgHooks['UserLoginForm'][] = 'modifyLoginForm';
function modifyLoginForm( &$template ) {
//Printed template and got the following
/*
UserloginTemplate Object
(
[data] => Array
(
[link] =>
[header] =>
[name] => Admin
[password] =>
[retype] =>
[email] =>
[realname] =>
[domain] =>
[reason] =>
[action] => /mediawiki/index.php?title=Special:UserLogin&action=submitlogin&type=login&returnto=Main+Page
[message] =>
[messagetype] => error
[createemail] =>
[userealname] => 1
[useemail] => 1
[emailrequired] =>
[emailothers] => 1
[canreset] => 1
[resetlink] => 1
[canremember] => 1
[usereason] =>
[remember] =>
[cansecurelogin] =>
[stickHTTPS] =>
[token] => 18955182baa69e0a66edefghi4e0ef
[loginend] =>
[signupend] =>
[usedomain] =>
)
*/
}
Tried to modify includes/templates/Userlogin.php . There is a login form, but it didn't get affected.
Checked LoginSignupSpecialPage.php, but not sure how to add the attribute.

I'm trying to use Shippo to get a USPS shipping label to send within the US, but can't seem to get any rates to appear

This is my request:
Address from:
Array(
[name] => Mr.John
[street1] => 1234 Market Street
[city] => San Francisco
[zip] => 95432
[state] => CA
[phone] => +1 415 123 1234
[email] => mrjohn+test#gmail.com
[country] => US
[object_purpose] => QUOTE
[company] => Shippo
)
Address to :
Array(
[name] => Ms. Jane
[street1] => 1234 Mission Street
[city] => San Francisco
[zip] => 91234
[state] => CA
[phone] => +1 415 234 2345
[email] => msjane+test#gmail.com
[country] => US
[object_purpose] => QUOTE
[street2] =>
[company] =>
)
Custom Item :
Shippo_Object Object(
[_apiKey:protected] => xxxx
[_values:protected] => Array (
[object_created] => [date]
[object_updated] => [date]
[object_id] => xxxxx
[object_owner] => sender+test#gmail.com
[object_state] => VALID
[description] => IPhone 6
[quantity] => 1
[net_weight] => 3
[mass_unit] => lb
[value_amount] => 450
[value_currency] => USD
[origin_country] => US
[tariff_number] =>
[metadata] => Order ID #123123
)
[_unsavedValues:protected] => Shippo_Util_Set Object (
[_elts:Shippo_Util_Set:private] => Array (
)
)
[_transientValues:protected] => Shippo_Util_Set Object (
[_elts:Shippo_Util_Set:private] => Array (
)
)
[_retrieveOptions:protected] => Array (
)
)
Custom Shipping :
Shippo_Object Object(
[_apiKey:protected] => xxxx
[_values:protected] => Array (
[object_created] => [date]
[object_updated] => [date]
[object_id] => xxxxx
[object_owner] => sender+test#gmail.com
[object_state] => VALID
[certify_signer] => Mr. John
[certify] => 1 [items] => Array (
[0] => xxxx
)
[non_delivery_option] => ABANDON
[contents_type] => MERCHANDISE
[contents_explanation] => IPhone 6
[exporter_reference] =>
[importer_reference] =>
[invoice] => #123123
[commercial_invoice] =>
[license] =>
[certificate] =>
[notes] =>
[eel_pfc] =>
[aes_itn] =>
[disclaimer] =>
[incoterm] =>
[metadata] => Order ID #123123
)
[_unsavedValues:protected] => Shippo_Util_Set Object (
[_elts:Shippo_Util_Set:private] => Array (
)
)
[_transientValues:protected] => Shippo_Util_Set Object (
[_elts:Shippo_Util_Set:private] => Array (
)
)
[_retrieveOptions:protected] => Array (
)
)
Am I miss something? I have address_to, address_from, custom item, and custom shipping all filled out.
I’m from the Shippo team here!
Everything in your call seems good. Please double check that you have your USPS account activated - you can edit it via the Carrier Accounts Endpoint or on the Carriers Page directly.
Since the shipment is domestic, you won’t need to add the “customs item”, nor “customs shipping” information. You should only provide this information when creating an international shipment.
Remove +1 from each phone number, that’s not needed and may cause problems.
Hope that’s helpful.

PayPal pre-approval giving error

I have used PayPal api in which first i do preapproval and then make chained payment using that approval key. Everything works fine on my local server. But as on live its giving me below error.
Preapproval
Error
PreapprovalResponse Object
(
[responseEnvelope] => ResponseEnvelope Object
(
[timestamp] => 2015-05-01T08:38:40.374-07:00
[ack] => Failure
[correlationId] => 88fffca2a737c
[build] => 15743565
)
[preapprovalKey] =>
[error] => Array
(
[0] => ErrorData Object
(
[errorId] => 580001
[domain] => PLATFORM
[subdomain] => Application
[severity] => Error
[category] => Application
[message] => Invalid request: Data validation warning(line -1, col 0): null
[exceptionId] =>
[parameter] => Array
(
[0] => ErrorParameter Object
(
[name] =>
[value] => Data validation warning(line -1, col 0): null
)
[1] => ErrorParameter Object
(
[name] =>
[value] => Data validation warning(line -1, col 0): null
)
)
)
)
)
My request is
requestEnvelope.errorLanguage=en_US&cancelUrl=http%3A%2F%2Fredesignbox.com%2Fopendemo%2Fhappyfund%2Fcheckout&currencyCode=RUB&maxAmountPerPayment=1%2C032.00&maxNumberOfPayments=1&maxTotalAmountOfAllPayments=1%2C032.00&returnUrl=http%3A%2F%2Fredesignbox.com%2Fopendemo%2Fhappyfund%2Fcheckout_action%2Faction%2FafterApproval&startingDate=2015-05-01&feesPayer=PRIMARYRECEIVER
Response is
responseEnvelope.timestamp=2015-05-01T08%3A38%3A40.374-07%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=88fffca2a737c&responseEnvelope.build=15743565&error(0).errorId=580001&error(0).domain=PLATFORM&error(0).subdomain=Application&error(0).severity=Error&error(0).category=Application&error(0).message=Invalid+request%3A+Data+validation+warning%28line+-1%2C+col+0%29%3A+null&error(0).parameter(0)=Data+validation+warning%28line+-1%2C+col+0%29%3A+null&error(0).parameter(1)=Data+validation+warning%28line+-1%2C+col+0%29%3A+null
What's wrong i cannot understand.
EDIT
On local my ssl version is
OpenSSL/0.9.8y and
on live its NSS/3.16.2.3 Basic ECC
$maxpaymentss = floor(2000/68.50);
$data = array(
'ClientDetails' => array(
'applicationId' => 'My_APP',
),
'returnUrl' => 'http://www.yourdomain.com/success.html',
'cancelUrl' => 'http://www.yourdomain.com/cancel.html',
'startingDate' => gmdate("Y-m-d\TH:i:s\Z"),
'endingDate' => gmdate("Y-m-d\TH:i:s\Z"),
'maxAmountPerPayment' => 68.50,
'maxNumberOfPayments' => $maxpaymentss,
'maxTotalAmountOfAllPayments' => 2000.00,
'maxNumberOfPaymentsPerPeriod' => 1,
'currencyCode' => 'USD',
'requestEnvelope' => array(
'errorLanguage' => 'en_US',
'detailLevel' => 'ReturnAll'
)
);
these are the required fields for the live mode of PayPal adaptive preapproval.
Remove the "," in the "maxAmountPerPayment" and "maxTotalAmountOfAllPayments" field and try again . It should work fine

Illuminate returns results in JSON - why?

I'm using Illuminate to access my database
<body>
<?php
$edges = Edge::all();
foreach ($edges as $key => $value) {
print $value;
}
?>
</body>
browser returns:
{"childID":"A","parentID":"C","updated_at":null,"created_at":null}{"childID":"B","parentID":"E","updated_at":null,"created_at":null}{"childID":"C","parentID":"D","updated_at":null,"created_at":null}{"childID":"C","parentID":"F","updated_at":null,"created_at":null}{"childID":"Y","parentID":"Z","updated_at":"2014-08-07 10:26:54","created_at":"2014-08-07 10:26:54"}
What's odd or unexpected for me at least is that my results are returned in JSON. If you could
shine some light on this, i.e. why this might be, or the reason is...I'd be grateful.
If I dump the results in the browser with:
<?php
print '<pre>';print_r($edges);
?>
produces:
Illuminate\Database\Eloquent\Collection Object
(
[items:protected] => Array
(
[0] => Edge Object
(
[connection:protected] =>
[table:protected] =>
[primaryKey:protected] => id
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[childID] => A
[parentID] => C
[updated_at] =>
[created_at] =>
)
[original:protected] => Array
(
[childID] => A
[parentID] => C
[updated_at] =>
[created_at] =>
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[fillable:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
)
[1] => Edge Object
(...)
...
)
In terms of the front-end results - I'm really only interested in the:
[childID] => A
[parentID] => C
[updated_at] =>
[created_at] =>
part of the object; only NOT in JSON; in plain text.

zend framework action name changes to 'id'

I have a zend framework application with modules 'dashboard' and 'admin' of which 'dashboard' is the default one. When I try to access a different module, I am getting the request object like this
Zend_Controller_Request_Http Object
(
[_paramSources:protected] => Array
(
[0] => _GET
[1] => _POST
)
[_requestUri:protected] => /admin/application/show/
[_baseUrl:protected] => http://local.dashmonitor.us.com
[_basePath:protected] =>
[_pathInfo:protected] => /admin/application/show/
[_params:protected] => Array
(
[module] => admin
[controller] => application
[action] => get
[id] => show
)
[_rawBody:protected] =>
[_aliases:protected] => Array
(
)
[_dispatched:protected] => 1
[_module:protected] => admin
[_moduleKey:protected] => module
[_controller:protected] => application
[_controllerKey:protected] => controller
[_action:protected] => get
[_actionKey:protected] => action
)
My real action name is 'show' but it changes to 'get' here. Can anybody please help?