original_string: public function delete($product_id)
      {
          $result = null;
          $this->hook->attach('product.related.delete.before', $product_id, $result, $this);
  
          if (isset($result)) {
              return (bool) $result;
          }
  
          foreach (array('product_id', 'item_product_id') as $field) {
              if (!$this->db->delete('product_related', array($field => $product_id))) {
                  return false;
              }
          }
  
          $this->hook->attach('product.related.delete.after', $product_id, $result, $this);
          return (bool) $result;
      }
code: public function delete($product_id)
      {
          $result = null;
          $this->hook->attach('product.related.delete.before', $product_id, $result, $this);
  
          if (isset($result)) {
              return (bool) $result;
          }
  
          foreach (array('product_id', 'item_product_id') as $field) {
              if (!$this->db->delete('product_related', array($field => $product_id))) {
                  return false;
              }
          }
  
          $this->hook->attach('product.related.delete.after', $product_id, $result, $this);
          return (bool) $result;
      }
code_tokens: public function delete ( $ product_id ) { $ result = null ; $ this -> hook -> attach ( 'product.related.delete.before' , $ product_id , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( bool ) $ result ; } foreach ( array ( 'product_id' , 'item_product_id' ) as $ field ) { if ( ! $ this -> db -> delete ( 'product_related' , array ( $ field => $ product_id ) ) ) { return false ; } } $ this -> hook -> attach ( 'product.related.delete.after' , $ product_id , $ result , $ this ) ; return ( bool ) $ result ; }
docstring: Deletes product relations
  @param int $product_id
  @return bool
docstring_tokens: Deletes product relations