Buyable() public method

Get the buyable object related to this item.
public Buyable ( )
 /**
  * This function is used by ItemDiscountAction, and the check function above.
  */
 public function itemMatchesCriteria(OrderItem $item, Discount $discount)
 {
     $types = $this->getTypes(true, $discount);
     if (!$types) {
         return true;
     }
     $buyable = $item->Buyable();
     return isset($types[$buyable->class]);
 }
 public function itemMatchesCriteria(OrderItem $item, Discount $discount)
 {
     $discountcategoryids = $discount->Categories()->getIDList();
     if (empty($discountcategoryids)) {
         return true;
     }
     //get category ids from buyable
     $buyable = $item->Buyable();
     if (!method_exists($buyable, "getCategoryIDs")) {
         return false;
     }
     $ids = array_intersect($buyable->getCategoryIDs(), $discountcategoryids);
     return !empty($ids);
 }