Когда я пытаюсь получить значение из объекта PHP, он возвращает ноль - PullRequest
0 голосов
/ 06 ноября 2011

Скажем, объект $ Item. Когда я снимаю его, используя var_dump ($ Item), получается:

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 ($ Item-> productVariationID), он возвращает 6114 .. но когда я использую var_dump ($ Item-> custom_text), он возвращает ноль ... Я не понимаю, в чем здесь проблема. Пожалуйста, кто-нибудь объясните мне.

1 Ответ

0 голосов
/ 06 ноября 2011

У вас нет $Item->custom_text и $Item->productVariationID в вашем объекте

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...