php - Yii Indirect modification of overloaded property -


  $ winner bids = bids :: model () - & gt; Search ($ criteria); Next related to the model:  
  Public function relation () {return array ('item' = & gt; array (auto :: BELONGS_TO, Array (auto :: BALOGOTO, 'Roomplayer', 'Values', 'Item_id'), 'Cell' = & gt; array (auto :: BELONGS_TO, 'room', 'room_id'), 'vendor' => 'Seller_id'), 'buyer' = & gt; array (auto :: BELONGS_TO, 'roomplayer', 'buyer_id'),); }   

When I'm trying to save:

  $ this-> seller-> Current_item ++; $ This- & gt; Seller- & gt; Win ++; $ This- & gt; Seller- & gt; Save (); I get the error:  

Indirect revision of overloaded property bid: $ seller has no effect (/ var / www / auction / Www / protected / models / bids.php16)

But was it okay on another server? how to fix it? Or override PHP instructions? any idea? TNX

The problem here is that there is no $ seller A "real" property (using Yii, magic __ go method implements properties on your model), so you are trying to modify the return value of the function (which has no effect is not). Looks like you tried:

  function foo () {return 42; } // INVALID code for invention (foo ()) ++;   

I am not sure about the status of this behavior on different PHP versions, but there is an easy solution that you can use:

  $ Seller = $ this- & gt; Dealer; $ Seller- & gt; CURRENT_ITEM ++; $ Seller- & gt; Win ++; $ Seller- & gt; Save ();    

Comments