I have a curious situation; I cannot get my data to pass to the front end, although it's set on the back end. For example, using Stripe's API
$data = \Stripe_Invoice::all(array(
"customer" => $user->customer_id
));
If I debug data, (debug($data)) I get this:
object(Stripe_List) {[protected] _apiKey => 'sk_test_wdsdfa3asfa3afR2lG2'[protected] _values => ['object' => 'list',... etc. etc.
If I try to pass it to the front end from an ajax call:
$this->set(compact('data', $data));
$this->set('_serialize', 'data');
I get this: '{}'
I also cannot log it as a session variable:
$_SESSION['log'] = $data;
echoing $_SESSION['log'] returns {}
What's the deal here? The data is clearly set if I debug it in the back end, but the moment I try to set and return a variable to the front end through ajax or session logging the data empties out. Any ideas? I imagine it has something to do with the variables being protected.
It's frustrating because I point all of the way down and something like $invoices->data->id and get NULL, but if I debug $invoices->data->id I get the correct id. How in the world do I pass it back through AJAX?