2011-11-06 3 views
0

オブジェクトが$ Itemだとします。私はのvar_dump($アイテム)を使用して、それをダンプすると得られます。それは6114を返しPHPオブジェクトから値を取得しようとすると、nullが返されます

object(ProductVariation_OrderItem)[29] 
    protected '_productVariationID' => string '6114' (length=4) 
    protected '_productVariationVersion' => string '4' (length=1) 
    protected '_productID' => string '4220' (length=4) 
    protected '_productVersion' => string '72' (length=2) 
    protected '_id' => null 
    protected '_quantity' => string '1' (length=1) 
    protected '_custom_text' => string 'erger ~~ gerger' (length=15) 
    protected '_custom_text_id' => string 'b266dfceb5db66c01f08d97c45ebccf1' (length=32) 
    public 'destroyed' => boolean false 
    protected 'record' => 
    array 
     'ID' => int 0 
     'ClassName' => string 'ProductVariation_OrderItem' (length=26) 
     'RecordClassName' => string 'ProductVariation_OrderItem' (length=26) 
    protected 'changed' => 
    array 
     empty 
    protected 'original' => 
    array 
     'ID' => int 0 
     'ClassName' => string 'ProductVariation_OrderItem' (length=26) 
     'RecordClassName' => string 'ProductVariation_OrderItem' (length=26) 
    protected 'components' => null 
    protected 'brokenOnWrite' => boolean false 
    protected 'brokenOnDelete' => boolean false 
    protected 'componentCache' => null 
    protected 'iteratorPos' => int 0 
    protected 'iteratorTotalItems' => int 1 
    protected 'failover' => null 
    protected '_object_cache' => 
    array 
     empty 
    protected '_xml_cache' => 
    array 
     empty 
    protected '_natural_cache' => 
    array 
     empty 
    protected 'customisedObj' => null 
    protected 'parent' => null 
    protected 'namedAs' => null 
    public 'class' => string 'ProductVariation_OrderItem' (length=26) 
    protected 'extension_instances' => 
    array 
     empty 

私が使用しての使用のvar_dump($アイテム - > productVariationID)..しかし、私はのvar_dump($アイテム - > custom_text)を使用する場合、それをnullを返します。私はここで何が問題なのか分かりません。誰かが私を説明してください。

+0

には$Item->custom_text$Item->productVariationIDを持っていませんか? – Vikk

+0

NOpe ..私は魔法を持っていません – IJas

答えて

0

あなたのクラスでマジックメソッド__getを持っていますかあなたのオブジェクト

+0

'_productVariationID' =>文字列 '6114'(長さ= 4)..これはどういう意味ですか??それは正しい値を与える?? – IJas

+0

@ijasnijas:それは$ Item - > _ productVariationIDではありません。$ Item - > _ productVariationID - それは大きな違いです! – genesis

+0

大きな違いは何ですか?どちらも同じですか?アンダースコアをスキップしたということですか? – IJas

関連する問題