$請求書のアクセス: - :ChargeBee請求書PHPのAPIリクエスト、私はPHP経由ChargeBeeのAPIに次の要求を行っています
ChargeBee_Invoice Object
(
[allowed:protected] => Array
(
[0] => id
[1] => poNumber
[2] => customerId
[3] => subscriptionId
)
[_values:protected] => Array
(
[id] => 4
[customer_id] => 2uyg23inuy2g3ou
[subscription_id] => 2uyg23inuy2g3ou
[line_items] => Array
(
[0] => Array
(
[id] => li_2uyg23inuy2g3ou
[date_from] => 1484106779
)
)
[sub_total] => 200
[linked_payments] => Array
(
[0] => Array
(
[txn_id] => txn_2uyg23inuy2g3ou
[applied_amount] => 200
[applied_at] => 1484106781
[txn_status] => success
[txn_date] => 1484106781
[txn_amount] => 200
)
)
[_subTypes:protected] => Array
(
[line_items] => ChargeBee_InvoiceLineItem
[discounts] => ChargeBee_InvoiceDiscount
[taxes] => ChargeBee_InvoiceTax
)
)
ChargeBee_Environment::configure("chargebee-test","test_uybGuyguyguykynkgYgkfvyt");
$all = ChargeBee_Invoice::all(array(
"customer_id" => 2uyg23inuy2g3ou,
"limit" => 5,
"status[is]" => "paid",
"total[lte]" => 1000,
"sortBy[asc]" => "date"));
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice);
echo'</pre>';
}
が$entry->invoice()
への各呼び出しは次のような構造を持つオブジェクトを返します
(返信されたリクエストがここに表示されるまでに長い時間がかかっているため、上記のデータ量を減らしました)
これは私が立ち往生しているところです。オブジェクトからのデータ?
私は次のことを試みた: -
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice->allowed);
echo'</pre>';
}
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice->allowed());
echo'</pre>';
}
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice->ChargeBee_Invoice);
echo'</pre>';
}
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice->ChargeBee_Invoice());
echo'</pre>';
}
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice['ChargeBee_Invoice']);
echo'</pre>';
}
foreach($all as $entry){
$invoice = $entry->invoice();
echo'<pre>';
print_r($invoice['allowed']);
echo'</pre>';
}
私はまた、次のコードで上記の多くのバリエーションを試みている: -
foreach($all as $entry){
$invoice = $entry->invoice();
foreach($invoice as $cinvoice) {
echo'<pre>';
print_r($cinvoice->allowed);
echo'</pre>';
}
}
しかし、私がしようとすべてがちょうど返します -
Fatal error: Uncaught exception 'Exception' with message 'Unknown property
いずれのヘルプまたは正しい方向へのプッシュは非常に高く評価されます
'_get'(1アンダースコア)は、クラス' Result'(ない彼が照会したいクラスの請求書)のためだけのプライベートな方法であり、魔法の方法ではありません。ドキュメンテーションのパブリックプロパティに関するビットは問題ありません。 – yivi
ああ... ChargeBee_Resultとそれへのリンク - これは私の残念な誤植です。私はChargeBee_Modelを意味しました。このクラスはChargeBee_Invoiceの親クラスです。そして、__get(2つのアンダースコア)によるマジックメソッドによるデータへのアクセスに関する私の記述は間違いではありません。ソースコードを参照してください。 – Ans