/**
  * translate the simple array of data we store in the db in souk back into a Stockpile\Quantity object.
  */
 protected function prepListing(Listing $listing)
 {
     $prior = $listing->priorstate();
     if ($prior) {
         $this->prepListing($prior);
     }
     if (!isset($listing->stockpile_quantity)) {
         return $listing;
     }
     $listing->quantity = $this->itemAccount($listing->seller)->defaultQuantity($listing->stockpile_quantity);
     unset($listing->stockpile_quantity);
     return $listing;
 }
 /**
  * when a listing changes, extract search vectors from that listing and update those cache keys
  * so that we can bust any cached search results that now may be invalid.
  */
 protected function updateListingSearchVectors(Listing $listing)
 {
     $this->updateSearchVector('seller' . $listing->seller);
     if ($listing->buyer) {
         $this->updateSearchVector('buyer' . $listing->buyer);
     }
     if ($listing->bidder) {
         $this->updateSearchVector('bidder' . $listing->bidder);
     }
     $prior = $listing->priorstate();
     if ($prior && $prior->bidder) {
         $this->updateSearchVector('bidder' . $prior->bidder);
     }
 }